home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / EVTQUERY.VB_ / evtquery.vbs
Encoding:
Text File  |  2003-02-21  |  113.2 KB  |  2,423 lines

  1. '********************************************************************
  2. '*
  3. '* Copyright (c) Microsoft Corporation. All rights reserved. 
  4. '*
  5. '* Module Name:    EVENTQUERY.vbs 
  6. '*
  7. '* Abstract:       Enables an administrator to query/view all existing
  8. '*                 events in a given event log(s).
  9. '*
  10. '*
  11. '********************************************************************
  12. ' Global declaration 
  13. OPTION EXPLICIT
  14.  
  15. ON ERROR RESUME NEXT
  16. Err.Clear
  17.  
  18. '----------------------------------------------------------------
  19. ' Start of localization Content
  20. '----------------------------------------------------------------
  21.  
  22. ' the filter operators specified by the user
  23. CONST L_OperatorEq_Text                 = "eq"
  24. CONST L_OperatorNe_Text                 = "ne"
  25. CONST L_OperatorGe_Text                 = "ge"
  26. CONST L_OperatorLe_Text                 = "le"
  27. CONST L_OperatorGt_Text                 = "gt"
  28. CONST L_OperatorLt_Text                 = "lt"
  29.  
  30. ' the filters as given by the user
  31. CONST L_UserFilterDateTime_Text         = "datetime"
  32. CONST L_UserFilterType_Text             = "type" 
  33. CONST L_UserFilterUser_Text             = "user" 
  34. CONST L_UserFilterComputer_Text         = "computer"
  35. CONST L_UserFilterSource_Text           = "source"
  36. CONST L_UserFilterDateCategory_Text     = "category"
  37. CONST L_UserFilterId_Text               = "id" 
  38.  
  39. ' the text displayed in columns when no output is obtained for display
  40. CONST L_TextNa_Text                     = "N/A"
  41. CONST L_TextNone_Text                   = "None"
  42.  
  43. ' the following texts are used while parsing the command-line arguments
  44. ' (passed as input to the function component.getArguments)
  45. CONST L_MachineName_Text                = "Server Name"
  46. CONST L_UserName_Text                   = "User Name"
  47. CONST L_UserPassword_Text               = "User Password"
  48. CONST L_Format_Text                     = "Format"
  49. CONST L_Range_Text                      = "Range"
  50. CONST L_Filter_Text                     = "Filter"
  51. CONST L_Log_Text                        = "Logname"
  52.  
  53. ' the column headers used in the output display
  54. CONST L_ColHeaderType_Text              = "Type"
  55. CONST L_ColHeaderDateTime_Text          = "Date Time"
  56. CONST L_ColHeaderSource_Text            = "Source"
  57. CONST L_ColHeaderCategory_Text          = "Category"
  58. CONST L_ColHeaderEventcode_Text         = "Event"
  59. CONST L_ColHeaderUser_Text              = "User"
  60. CONST L_ColHeaderComputerName_Text      = "ComputerName"
  61. CONST L_ColHeaderDesription_Text        = "Description"
  62.  
  63. ' Maximum Column Header Lengths used to display various fields.
  64. ' Localization team can adjust these five column lengths to fit the localized strings, but
  65. ' their sum should come to 74.  We always want to limit the total chars displayed per line to 79
  66. ' 74 chars + 5 spaces to separate the columns == 79 .
  67.  
  68. CONST L_ColHeaderTypeLength_Text        = 13
  69. CONST L_ColHeaderDateTimeLength_Text    = 23
  70. CONST L_ColHeaderSourceLength_Text          = 17    'This is the most preferred one to shorten.
  71. CONST L_ColHeaderComputerNameLength_Text    = 15
  72. CONST L_ColHeaderEventcodeLength_Text       = 6
  73.  
  74. 'These can be changed as it will not have any effect on the display.
  75.  
  76. CONST L_ColHeaderUserLength_Text            = 20
  77. CONST L_ColHeaderCategoryLength_Text    = 15
  78. CONST L_ColHeaderDesriptionLength_Text      = 0
  79.  
  80.  
  81. ' variable use to  concatenate  the Localization Strings.
  82. ' Error Messages 
  83. Dim UseCscriptErrorMessage
  84. Dim InvalidParameterErrorMessage
  85. Dim InvalidFormatErrorMessage
  86. Dim InvalidCredentialsForServerErrorMessage
  87. Dim InvalidCredentialsForUserErrorMessage
  88. Dim InvalidSyntaxErrorMessage
  89. Dim InvalidInputErrorMessage
  90. Dim InvalidORSyntaxInFilterErrorMessage
  91. Dim InvalidSyntaxMoreNoRepeatedErrorMessage
  92.  
  93.  
  94. CONST L_HelpSyntax1_Message                 = "Type ""%1 /?"" for usage."
  95. CONST L_HelpSyntax2_Message                 = "Type ""%2 /?"" for usage."
  96.  
  97. CONST L_InvalidParameter1_ErrorMessage      = "ERROR: Invalid Argument/Option - '%1'." 
  98. InvalidParameterErrorMessage                = L_InvalidParameter1_ErrorMessage & vbCRLF & L_HelpSyntax2_Message
  99.  
  100. CONST L_InvalidFormat1_ErrorMessage             = "ERROR: Invalid 'FORMAT' '%1' specified." 
  101. InvalidFormatErrorMessage                       = L_InvalidFormat1_ErrorMessage  &  vbCRLF & L_HelpSyntax2_Message
  102.  
  103. CONST L_InvalidRange_ErrorMessage               = "ERROR: Invalid 'RANGE' '%1' specified."
  104. CONST L_Invalid_ErrorMessage                    = "ERROR: Invalid '%1'."
  105. CONST L_InvalidType_ErrorMessage                = "ERROR: Invalid 'TYPE' '%1' specified for the 'FILTER' '%2'."
  106. CONST L_InvalidUser_ErrorMessage                = "ERROR: Invalid 'USER' '%1' specified for the 'FILTER '%2'."
  107. CONST L_InvalidId_ErrorMessage                  = "ERROR: Invalid 'ID' '%1' specified for the 'FILTER' '%2'."
  108. CONST L_InvalidFilter_ErrorMessage              = "ERROR: Invalid 'FILTER' '%1' specified for the 'FILTER' '%2'."
  109. CONST L_InvalidFilterFormat_ErrorMessage        = "ERROR: The FILTER '%1' is not in the required format."
  110. CONST L_InvalidFilterOperation_ErrorMessage     = "ERROR: Invalid FILTER operator '%1' specified for the filter '%2'."
  111.  
  112. CONST  L_InvalidCredentialsForServer1_ErrorMessage   = "ERROR: Invalid Syntax. /U can only be specified only when /S is specified."
  113. InvalidCredentialsForServerErrorMessage              = L_InvalidCredentialsForServer1_ErrorMessage  & vbCRLF & L_HelpSyntax1_Message
  114.  
  115. CONST  L_InvalidCredentialsForUser1_ErrorMessage = "ERROR: Invalid Syntax. /P can be only specified only when /U is specified."
  116. InvalidCredentialsForUserErrorMessage            = L_InvalidCredentialsForUser1_ErrorMessage & vbCRLF & L_HelpSyntax1_Message
  117.  
  118. CONST L_InvalidOperator_ErrorMessage             = "ERROR: Invalid operator specified for the range of dates in the 'DATETIME' filter."
  119. CONST L_InvalidDateTimeFormat_ErrorMessage       = "ERROR: Invalid 'DATETIME' format specified. Format:MM/dd/yy(yyyy),hh:mm:ssAM([/PM)]"
  120.  
  121. CONST L_ExecuteQuery_ErrorMessage               = "ERROR: Unable to execute the query for the '%1' log."
  122. CONST L_LogDoesNotExist_ErrorMessage            = "ERROR: The log file '%1' does not exist."
  123. CONST L_InstancesFailed_ErrorMessage            = "ERROR: Unable to get the log details from the system."    
  124.  
  125. CONST  L_InvalidSyntax1_ErrorMessage            = "ERROR: Invalid Syntax." 
  126. InvalidSyntaxErrorMessage                       = L_InvalidSyntax1_ErrorMessage & vbCRLF &  L_HelpSyntax1_Message
  127.  
  128. CONST L_InvalidInput1_ErrorMessage              = "ERROR: Invalid input. Please check the input Values."
  129. InvalidInputErrorMessage                        = L_InvalidInput1_ErrorMessage & vbCRLF &  L_HelpSyntax1_Message
  130.  
  131. CONST  L_ObjCreationFail_ErrorMessage           = "ERROR: Unexpected Error, Query failed. "
  132. CONST L_InfoUnableToInclude_ErrorMessage        = "ERROR: Unable to include the common module""CmdLib.Wsc""."
  133. CONST L_ComponentNotFound_ErrorMessage          = "ERROR: Unable to create the component '%1'."
  134. CONST L_NoHeaderaNotApplicable_ErrorMessage     = "ERROR: /NH option is allowed only for ""TABLE"" and ""CSV"" formats."
  135. CONST L_InValidServerName_ErrorMessage          = "ERROR: Invalid Syntax. System name cannot be empty."
  136. CONST L_InValidUserName_ErrorMessage            = "ERROR: Invalid Syntax. User name cannot be empty. "
  137.  
  138. CONST  L_InvalidORSyntaxInFilter1_ErrorMessage  = "ERROR: Invalid 'OR' operation is specified for the filter."
  139. CONST  L_InvalidORSyntaxInFilter2_ErrorMessage  = "'OR' operation valid only for filters TYPE and ID."      
  140. InvalidORSyntaxInFilterErrorMessage             = L_InvalidORSyntaxInFilter1_ErrorMessage & vbCRLF & L_InvalidORSyntaxInFilter2_ErrorMessage
  141.  
  142. CONST  L_InvalidSyntaxMoreNoRepeated1_ErrorMessage = "ERROR: Invalid Syntax. '%1' option is not allowed more than 1 time(s)."
  143. InvalidSyntaxMoreNoRepeatedErrorMessage            = L_InvalidSyntaxMoreNoRepeated1_ErrorMessage  & vbCRLF &  L_HelpSyntax2_Message  
  144.  
  145. '  Hints given in case of errors
  146. CONST L_HintCheckConnection_Message           = "ERROR: Please check the system name, credentials and WMI (WBEM) service."
  147.  
  148. ' Informational messages
  149. CONST L_InfoNoRecordsInFilter_Message         = "INFO: No records available for the '%1' log with the specified criteria."
  150. CONST L_InfoNoRecords_Message                 = "INFO: No records available for the '%1' log."
  151. CONST L_InfoNoLogsPresent_Message             = "INFO: No logs are available in the system."
  152. CONST L_InfoDisplayLog_Message                = "Listing the events in '%1' log of host '%2'"
  153.  
  154. ' Cscript usage strings
  155. CONST L_UseCscript1_ErrorMessage    = "This script should be executed from the command prompt using CSCRIPT.EXE."
  156. CONST L_UseCscript2E_ErrorMessage   = "For example: CSCRIPT  %windir%\System32\EVENTQUERY.vbs <arguments>"
  157. CONST L_UseCscript3_ErrorMessage    = "To set CScript as the default application to run .vbs files, run the following:"
  158. CONST L_UseCscript4_ErrorMessage    = "       CSCRIPT //H:CSCRIPT //S" 
  159. CONST L_UseCscript5E_ErrorMessage   = "You can then run ""%windir%\System32\EVENTQUERY.vbs <arguments>"" without preceding the script with CSCRIPT."
  160.  
  161. ' Contents for showing help for Usage 
  162. CONST L_ShowUsageLine00_Text            = "No logs are available on this system for query."
  163. CONST L_ShowUsageLine01_Text            = "EVENTQUERY.vbs [/S system [/U username [/P password]]] [/V] [/FI filter]"
  164. CONST L_ShowUsageLine02_Text            = "               [/FO format] [/R range] [/NH] [/L logname | *]"
  165. CONST L_ShowUsageLine03_Text            = "Description:"
  166. CONST L_ShowUsageLine04_Text            = "    The EVENTQUERY.vbs script enables an administrator to list"
  167. CONST L_ShowUsageLine05_Text            = "    the events and event properties from one or more event logs."
  168. CONST L_ShowUsageLine06_Text            = "Parameter List:"
  169. CONST L_ShowUsageLine07_Text            = "    /S     system          Specifies the remote system to connect to."
  170. CONST L_ShowUsageLine08_Text            = "    /U     [domain\]user   Specifies the user context under which the"
  171. CONST L_ShowUsageLine09_Text            = "                           command should execute."
  172. CONST L_ShowUsageLine10_Text            = "    /P     password        Specifies the password for the given"
  173. CONST L_ShowUsageLine11_Text            = "                           user context."
  174. CONST L_ShowUsageLine12_Text            = "    /V                     Displays verbose information. Specifies that "
  175. CONST L_ShowUsageLine13_Text            = "                           the detailed information should be displayed "
  176. CONST L_ShowUsageLine14_Text            = "                           in the output."
  177. CONST L_ShowUsageLine15_Text            = "    /FI    filter          Specifies the types of events to"
  178. CONST L_ShowUsageLine16_Text            = "                           filter in or out of the query."
  179. CONST L_ShowUsageLine17_Text            = "    /FO    format          Specifies the format in which the output"
  180. CONST L_ShowUsageLine18_Text            = "                           is to be displayed."
  181. CONST L_ShowUsageLine19_Text            = "                           Valid formats are ""TABLE"", ""LIST"", ""CSV""."
  182. CONST L_ShowUsageLine20_Text            = "    /R     range           Specifies the range of events to list."
  183. CONST L_ShowUsageLine21_Text            = "                           Valid Values are:"
  184. CONST L_ShowUsageLine22_Text            = "                               'N' - Lists 'N' most recent events."
  185. CONST L_ShowUsageLine23_Text            = "                              '-N' - Lists 'N' oldest events."
  186. CONST L_ShowUsageLine24_Text            = "                           'N1-N2' - Lists the events N1 to N2." 
  187. CONST L_ShowUsageLine25_Text            = "    /NH                    Specifies that the ""Column Header"" should"
  188. CONST L_ShowUsageLine26_Text            = "                           not be displayed in the output."
  189. CONST L_ShowUsageLine27_Text            = "                           Valid only for ""TABLE"" and ""CSV"" formats."
  190. CONST L_ShowUsageLine28_Text            = "    /L     logname         Specifies the log(s) to query."
  191. CONST L_ShowUsageLine29_Text            = "    /?                     Displays this help/usage message."
  192. CONST L_ShowUsageLine30_Text            = "    Valid Filters  Operators allowed   Valid Values"
  193. CONST L_ShowUsageLine31_Text            = "    -------------  ------------------  ------------"
  194. CONST L_ShowUsageLine32_Text            = "    DATETIME       eq,ne,ge,le,gt,lt   MM/dd/yy(yyyy),hh:mm:ssAM(/PM)"
  195. CONST L_ShowUsageLine33_Text            = "    TYPE           eq,ne               SUCCESS, ERROR, INFORMATION,"
  196. CONST L_ShowUsageLine34_Text            = "                                       WARNING, SUCCESSAUDIT,"
  197. CONST L_ShowUsageLine35_Text            = "                                       FAILUREAUDIT"
  198. CONST L_ShowUsageLine36_Text            = "    ID             eq,ne,ge,le,gt,lt   non-negative integer(0 - 65535)"
  199. CONST L_ShowUsageLine37_Text            = "    USER           eq,ne               string"
  200. CONST L_ShowUsageLine38_Text            = "    COMPUTER       eq,ne               string"
  201. CONST L_ShowUsageLine39_Text            = "    SOURCE         eq,ne               string"
  202. CONST L_ShowUsageLine40_Text            = "    CATEGORY       eq,ne               string"
  203. CONST L_ShowUsageLine41_Text            = "NOTE: Filter ""DATETIME"" can be specified as ""FromDate-ToDate"""
  204. CONST L_ShowUsageLine42_Text            = "      Only ""eq"" operator can be used for this format."
  205. CONST L_ShowUsageLine43_Text            = "Examples:"
  206. CONST L_ShowUsageLine44_Text            = "    EVENTQUERY.vbs "
  207. CONST L_ShowUsageLine45_Text            = "    EVENTQUERY.vbs /L system  "
  208. CONST L_ShowUsageLine46_Text            = "    EVENTQUERY.vbs /S system /U user /P password /V /L *"
  209. CONST L_ShowUsageLine47_Text            = "    EVENTQUERY.vbs /R 10 /L Application /NH"
  210. CONST L_ShowUsageLine48_Text            = "    EVENTQUERY.vbs /R -10 /FO LIST /L Security"
  211. CONST L_ShowUsageLine49_Text            = "    EVENTQUERY.vbs /R 5-10 /L ""DNS Server"""
  212. CONST L_ShowUsageLine50_Text            = "    EVENTQUERY.vbs /FI ""Type eq Error"" /L Application"
  213. CONST L_ShowUsageLine51_Text            = "    EVENTQUERY.vbs /L Application"
  214. CONST L_ShowUsageLine52_Text            = "            /FI ""Datetime eq 08/15/02,03:15:00AM-08/15/02,03:15:00PM"""
  215. CONST L_ShowUsageLine53_Text            = "    EVENTQUERY.vbs /FI ""Datetime gt 07/04/02,04:27:00PM"" "
  216. CONST L_ShowUsageLine54_Text            = "            /FI ""Id gt 700"" /FI ""Type eq warning"" /L System"
  217. CONST L_ShowUsageLine55_Text            = "    EVENTQUERY.vbs /FI ""Type eq error OR Id gt 1000 """
  218. '-------------------------------------------------------------------------
  219. ' END of localization content
  220. '-------------------------------------------------------------------------
  221.  
  222. ' Define default values
  223. CONST ConstDefaultFormat_Text         = "TABLE"
  224.  
  225. ' Define other format  values
  226. CONST Const_List_Format_Text          = "LIST"
  227. CONST Const_Csv_Format_Text           = "CSV"
  228.  
  229. ' Define constants
  230. CONST CONST_ERROR                 = 0
  231. CONST CONST_CSCRIPT               = 2
  232. CONST CONST_SHOW_USAGE            = 3
  233. CONST CONST_PROCEED               = 4
  234. CONST CONST_ERROR_USAGE           = 5
  235. CONST CONST_NO_MATCHES_FOUND      = 0
  236.  
  237. ' Define the Exit Values
  238. CONST EXIT_SUCCESS                = 0
  239. CONST EXIT_UNEXPECTED             = 255
  240. CONST EXIT_INVALID_INPUT          = 254
  241. CONST EXIT_METHOD_FAIL            = 250
  242. CONST EXIT_INVALID_PARAM          = 999
  243. CONST EXIT_INVALID_PARAM_DEFAULT_OPTION_REPEATED = 777
  244.  
  245. ' Define default values
  246. CONST CONST_ARRAYBOUND_NUMBER     = 10
  247. CONST CONST_ID_NUMBER             = 65535
  248.  
  249. ' Define namespace and class names of wmi
  250. CONST CONST_NAMESPACE_CIMV2       = "root\cimv2"
  251. CONST CLASS_EVENTLOG_FILE         = "Win32_NTEventlogFile"
  252.  
  253. ' for blank line in  help usage   
  254. CONST EmptyLine_Text          = " "
  255.  
  256. ' Define the various strings used in the script
  257. '=============================================
  258. ' the valid options supported by the script
  259. CONST OPTION_SERVER               = "s"
  260. CONST OPTION_USER                 = "u"
  261. CONST OPTION_PASSWORD             = "p"
  262. CONST OPTION_FORMAT               = "fo"
  263. CONST OPTION_RANGE                = "r"
  264. CONST OPTION_NOHEADER             = "nh"
  265. CONST OPTION_VERBOSE              = "v"
  266. CONST OPTION_FILTER               = "fi"
  267. CONST OPTION_HELP                 = "?"
  268. CONST OPTION_LOGNAME              = "l"
  269.  
  270. ' the property names on which the user given filters are applied
  271. CONST FLD_FILTER_DATETIME         = "TimeGenerated"
  272. CONST FLD_FILTER_TYPE             = "Type"
  273. CONST FLD_FILTER_USER             = "User"
  274. CONST FLD_FILTER_COMPUTER         = "ComputerName"
  275. CONST FLD_FILTER_SOURCE           = "SourceName"
  276. CONST FLD_FILTER_CATEGORY         = "CategoryString"
  277. CONST FLD_FILTER_ID               = "EventCode"
  278. CONST FLD_FILTER_EVENTTYPE        = "EventType"
  279.  
  280. ' Define matching patterns used in validations
  281. CONST PATTERNFORMAT              = "^(table|list|csv)$"
  282. CONST PATTERNTYPE                = "^(SUCCESS|ERROR|INFORMATION|WARNING|SUCCESSAUDIT|FAILUREAUDIT)$"
  283.  
  284. ' Property values on which the user is given for the filter TYPE is applied  
  285. CONST PATTERNTYPE_ERROR           = "ERROR"
  286. CONST PATTERNTYPE_WARNING         = "WARNING"
  287. CONST PATTERNTYPE_INFORMATION     = "INFORMATION"
  288. CONST PATTERNTYPE_SUCCESSAUDIT    = "SUCCESSAUDIT"
  289. CONST PATTERNTYPE_FAILUREAUDIT    = "FAILUREAUDIT"
  290. CONST PATTERNTYPE_SUCCESS     = "SUCCESS"
  291.  
  292. CONST FLDFILTERTYPE_SUCCESSAUDIT       = "audit success"
  293. CONST FLDFILTERTYPE_FAILUREAUDIT        = "audit failure"
  294.  
  295. ' Define EventType
  296. CONST EVENTTYPE_SUCCESS  = "0"
  297. CONST EVENTTYPE_ERROR             = "1"
  298. CONST EVENTTYPE_WARNING           = "2"
  299. CONST EVENTTYPE_INFORMATION       = "3"
  300. CONST EVENTTYPE_SUCCESSAUDIT      = "4"
  301. CONST EVENTTYPE_FAILUREAUDIT      = "5"
  302.  
  303.  
  304. ' the operator symbols
  305. CONST SYMBOL_OPERATOR_EQ          = "="
  306. CONST SYMBOL_OPERATOR_NE          = "<>"
  307. CONST SYMBOL_OPERATOR_GE          = ">="
  308. CONST SYMBOL_OPERATOR_LE          = "<="
  309. CONST SYMBOL_OPERATOR_GT          = ">"
  310. CONST SYMBOL_OPERATOR_LT          = "<"
  311.  
  312. ' Define matching patterns used in validations
  313. CONST PATTERN_RANGE               = "^\d*-?\d+$"
  314. CONST PATTERN_FILTER              = "^([a-z]+)([\s]+)([a-z]+)([\s]+)([\w+]|[\W+]|\\)"
  315. CONST PATTERN_DATETIME            = "^\d{1,2}\/\d{1,2}\/\d{2,4},\d{1,2}:\d{1,2}:\d{1,2}(A|P)M$"
  316. CONST PATTERN_INVALID_USER        = "\|\[|\]|\:|\||\<|\>|\+|\=|\;|\,|\?|\*"
  317. CONST PATTERN_ID                  = "^(\d+)$"
  318. CONST PATTERN_DATETIME_RANGE      = "^\d{1,2}\/\d{1,2}\/\d{2,4},\d{1,2}:\d{1,2}:\d{1,2}(A|P)M\-\d{1,2}\/\d{1,2}\/\d{2,4},\d{1,2}:\d{1,2}:\d{1,2}(A|P)M$"
  319.  
  320. ' Define  UNC  format for server name  
  321. CONST   UNC_Format_Servername     = "\\"
  322.  
  323. ' Define  const for  filter  separation when OR  or ANDis specified in filter 
  324. CONST L_OperatorOR_Text           = " OR "
  325. CONST L_OperatorAND_Text           = " AND "
  326.  
  327. ' Variable to trap local if already connection in wmiconnect function 
  328. Dim blnLocalConnection  
  329.  
  330.  blnLocalConnection = False 'defalut value
  331.  
  332. ' to include the common module
  333. Dim component                ' object to store  common module   
  334.  
  335. Set component = CreateObject( "Microsoft.CmdLib" )
  336.  
  337. If Err.Number Then
  338.     WScript.Echo(L_InfoUnableToInclude_ErrorMessage)
  339.     WScript.Quit(EXIT_METHOD_FAIL)
  340. End If
  341.  
  342. ' referring the script host to common module 
  343. Set component.ScriptingHost = WScript.Application
  344.  
  345. ' Check whether the script is run using CScript
  346. If CInt( component.checkScript() ) <> CONST_CSCRIPT Then
  347.  
  348. UseCscriptErrorMessage        = L_UseCscript1_ErrorMessage & vbCRLF & _
  349.                                           ExpandEnvironmentString(L_UseCscript2E_ErrorMessage) & vbCRLF & vbCRLF & _
  350.                                            L_UseCscript3_ErrorMessage & vbCRLF & _
  351.                                            L_UseCscript4_ErrorMessage & vbCRLF & vbCRLF & _
  352.                                            ExpandEnvironmentString(L_UseCscript5E_ErrorMessage)
  353.  
  354.         WScript.Echo (UseCscriptErrorMessage)
  355.         WScript.Quit(EXIT_UNEXPECTED)
  356. End If
  357.  
  358. ' Calling the Main function 
  359. Call VBMain()   
  360.  
  361. ' end of the Main  
  362. Wscript.Quit(EXIT_SUCCESS) 
  363.  
  364.  
  365. '********************************************************************
  366. '* Sub: VBMain
  367. '*
  368. '* Purpose: This is main function that starts execution 
  369. '*
  370. '*
  371. '* Input/ Output: None
  372. '********************************************************************
  373. Sub VBMain()
  374.  
  375. ON ERROR RESUME NEXT
  376. Err.clear
  377.  
  378. ' Declare variables
  379. Dim intOpCode               ' to check the operation asked for, Eg:Help /?, etc
  380. Dim strMachine              ' the machine to query the events from
  381. Dim strUserName             ' the user name to use to query the machine 
  382. Dim strPassword             ' the password for the user to query the machine
  383. Dim strFormat               ' format of display, default is table
  384. Dim strRange                ' to store the range of records specified
  385. Dim blnNoHeader             ' flag to store if header is not required
  386. Dim blnVerboseDisplay       ' flag to verify if verbose display is needed 
  387. ReDim arrFilters(5)         ' to store all the given filters
  388. Dim objLogs                 ' a object to store all the given logfles
  389.  
  390. ' Initialize variables
  391. intOpCode            = 0
  392. strFormat            = ConstDefaultFormat_Text
  393. strRange             = ""
  394. blnNoHeader          = FALSE
  395. blnVerboseDisplay    = FALSE
  396.  
  397.  ' create the collection object
  398. Set objLogs = CreateObject("Scripting.Dictionary")
  399.      If Err.Number Then
  400.            component.vbPrintf L_ComponentNotFound_ErrorMessage, Array("Scripting.Dictionary")
  401.             WScript.Quit(EXIT_METHOD_FAIL)
  402.      End If
  403.  
  404. ' setting Dictionary object compare mode to VBBinaryCompare
  405. objLogs.CompareMode = VBBinaryCompare
  406.  
  407. ' Parse the command line
  408. intOpCode = intParseCmdLine(strMachine, _
  409.                             strUserName, _
  410.                             strPassword, _
  411.                             arrFilters, _
  412.                             strFormat, _
  413.                             strRange, _
  414.                             blnVerboseDisplay, _
  415.                             blnNoHeader, _
  416.                             objLogs)
  417.  
  418.   If Err.number then
  419.     ' error in parsing the Command line
  420.      component.vbPrintf InvalidInputErrorMessage ,Array(Ucase(Wscript.ScriptName))
  421.     WScript.Quit(EXIT_UNEXPECTED)
  422.   End If
  423.  
  424. ' check the operation specified by the user
  425. Select Case intOpCode
  426.  
  427.     Case CONST_SHOW_USAGE
  428.         ' help asked for
  429.         Call ShowUsage()
  430.  
  431.     Case CONST_PROCEED
  432.         Call ShowEvents(strMachine, strUserName, strPassword, _
  433.             arrFilters, strFormat, strRange, _
  434.             blnVerboseDisplay, blnNoHeader, objLogs)
  435.             ' completed successfully
  436.             WScript.Quit(EXIT_SUCCESS)
  437.  
  438.     Case CONST_ERROR
  439.         ' print common help message.  
  440.         component.vbPrintf L_HelpSyntax1_Message, Array(Ucase(Wscript.ScriptName))
  441.         Wscript.Quit(EXIT_INVALID_INPUT)
  442.  
  443.     Case CONST_ERROR_USAGE
  444.         ' help is asked for help with some other parameters
  445.         component.vbPrintf InvalidSyntaxErrorMessage, Array(Ucase(Wscript.ScriptName))
  446.         WScript.Quit(EXIT_INVALID_INPUT)
  447.  
  448.     Case EXIT_INVALID_PARAM_DEFAULT_OPTION_REPEATED
  449.             'Option repeated, input values  specified. Message displayed by the parser so just exit with error code.
  450.             Wscript.Quit(EXIT_INVALID_PARAM)
  451.  
  452.     Case Else
  453.             'Invalid input values specified.
  454.             component.vbPrintf InvalidSyntaxErrorMessage, Array(Ucase(Wscript.ScriptName))
  455.             Wscript.Quit(EXIT_INVALID_PARAM)
  456.  
  457. End Select
  458.  
  459. End Sub
  460. '***************************  End of Main  **************************
  461.  
  462. '********************************************************************
  463. '* Function: intParseCmdLine
  464. '*
  465. '* Purpose:  Parses the command line arguments to the variables
  466. '*
  467. '* Input:    
  468. '*  [out]    strMachine         machine to query events from
  469. '*  [out]    strUserName        user name to connect to the machine
  470. '*  [out]    strPassword        password for the user
  471. '*  [out]    arrFilters         the array containing the filters
  472. '*  [out]    strFormat          the display format
  473. '*  [out]    strRange           the range of records required
  474. '*  [out]    blnVerboseDisplay  flag to verify if verbose display is needed 
  475. '*  [out]    blnNoHeader        flag to verify if noheader display is needed  
  476. '*  [out]    objLogs             to store all the given logfles
  477. '* Output:   Returns CONST_PROCEED, CONST_SHOW_USAGE or CONST_ERROR
  478. '*           Displays error message and quits if invalid option is asked
  479. '*
  480. '********************************************************************
  481. Private Function intParseCmdLine( ByRef strMachine,      _
  482.                                   ByRef strUserName,     _
  483.                                   ByRef strPassword,     _
  484.                                   ByRef arrFilters,      _
  485.                                   ByRef strFormat,       _
  486.                                   ByRef strRange,        _
  487.                                   ByRef blnVerboseDisplay, _
  488.                                   ByRef blnNoHeader,_
  489.                                   ByRef objLogs)
  490.  
  491.     ON ERROR RESUME NEXT
  492.     Err.Clear
  493.  
  494.     Dim strUserGivenArg ' to temporarily store the user given arguments to script
  495.     Dim strTemp         ' to store temporary values
  496.     Dim intArgIter      ' to count the number of arguments given by user
  497.     Dim intArgLogType   ' to count number of log files specified - Used in ReDim
  498.     Dim intFilterCount  ' to count number of filters specified - Used in ReDim
  499.  
  500.     Dim blnHelp         ' to check if already Help is specified  
  501.     Dim blnFormat       ' to check if  already Format is specified  
  502.     Dim blnRange        ' to check if already Range is specified  
  503.     Dim blnServer       ' to check if already Server is specified  
  504.     Dim blnPassword     ' to check if already Password is specified  
  505.     Dim blnUser     ' to check if already User is specified  
  506.  
  507.     strUserGivenArg  = ""
  508.     intArgLogType    = 0
  509.     intFilterCount   = 0
  510.     intArgIter       = 0 
  511.  
  512.     'default values  
  513.     blnHelp         =  False
  514.     blnPassword   =  False
  515.     blnUser         =  False
  516.     blnServer        =  False
  517.     blnFormat      =  False
  518.  
  519.  
  520.     ' Retrieve the command line and set appropriate variables
  521. Do While intArgIter <= Wscript.arguments.Count - 1
  522.      strUserGivenArg = Wscript.arguments.Item(intArgIter)
  523.  
  524.  IF   Left( strUserGivenArg,1) = "/"  OR    Left( strUserGivenArg,1) = "-"  Then 
  525.          strUserGivenArg = Right( strUserGivenArg,Len(strUserGivenArg) -1 )
  526.  
  527.         Select Case LCase(strUserGivenArg)
  528.             Case LCase(OPTION_SERVER)
  529.  
  530.                     'If more than  1 time(s) is spcecified
  531.                 If  blnServer  =True   Then
  532.                   component.vbPrintf InvalidSyntaxMoreNoRepeatedErrorMessage, Array(Wscript.arguments.Item(intArgIter), Ucase(Wscript.ScriptName))
  533.                 intParseCmdLine = EXIT_INVALID_PARAM_DEFAULT_OPTION_REPEATED
  534.                 Exit Function 
  535.                 End If 
  536.  
  537.             If Not component.getArguments(L_MachineName_Text, strMachine, intArgIter, FALSE) Then
  538.                 intParseCmdLine = CONST_ERROR
  539.                 Exit Function
  540.             End If
  541.  
  542.             blnServer  =True
  543.                 intArgIter = intArgIter + 1
  544.  
  545.             Case LCase(OPTION_USER)
  546.  
  547.                     'If more than  1 time(s) is spcecified
  548.                 If  blnUser  =True   Then
  549.                  component.vbPrintf InvalidSyntaxMoreNoRepeatedErrorMessage, Array(Wscript.arguments.Item(intArgIter), Ucase(Wscript.ScriptName))
  550.                 intParseCmdLine = EXIT_INVALID_PARAM_DEFAULT_OPTION_REPEATED
  551.                 Exit Function 
  552.                 End If 
  553.  
  554.             If Not component.getArguments(L_UserName_Text, strUserName, intArgIter, FALSE) Then
  555.                 intParseCmdLine = CONST_ERROR
  556.                 Exit Function
  557.             End If
  558.            
  559.             blnUser  =True
  560.                 intArgIter = intArgIter + 1
  561.  
  562.             Case LCase(OPTION_PASSWORD)
  563.  
  564.                     'If more than  1 time(s) is spcecified
  565.                     If  blnPassword  =True   Then
  566.                  component.vbPrintf InvalidSyntaxMoreNoRepeatedErrorMessage, Array(Wscript.arguments.Item(intArgIter), Ucase(Wscript.ScriptName))
  567.                 intParseCmdLine = EXIT_INVALID_PARAM_DEFAULT_OPTION_REPEATED
  568.                 Exit Function 
  569.              End If 
  570.  
  571.             If Not component.getArguments(L_UserPassword_Text, strPassword, intArgIter, FALSE) Then
  572.                 intParseCmdLine = CONST_ERROR
  573.                 Exit Function
  574.             End If
  575.  
  576.             blnPassword  =True
  577.             intArgIter = intArgIter + 1
  578.  
  579.             Case LCase(OPTION_FORMAT) 
  580.  
  581.                                'If more than  1 time(s) is spcecified
  582.             If  blnFormat  =True   Then
  583.                 component.vbPrintf InvalidSyntaxMoreNoRepeatedErrorMessage, Array(Wscript.arguments.Item(intArgIter), Ucase(Wscript.ScriptName))
  584.                 intParseCmdLine = EXIT_INVALID_PARAM_DEFAULT_OPTION_REPEATED
  585.                 Exit Function 
  586.             End If 
  587.  
  588.             If Not component.getArguments(L_Format_Text,strFormat, intArgIter, FALSE) Then
  589.                 intParseCmdLine = CONST_ERROR
  590.                 Exit Function
  591.             End If
  592.  
  593.             
  594.             blnFormat  =True
  595.             intArgIter = intArgIter + 1
  596.            
  597.             Case LCase(OPTION_RANGE)
  598.  
  599.                    'If more than  1 time(s) is spcecified
  600.             If  blnRange  =True   Then
  601.                  component.vbPrintf InvalidSyntaxMoreNoRepeatedErrorMessage, Array(Wscript.arguments.Item(intArgIter), Ucase(Wscript.ScriptName))
  602.                 intParseCmdLine = EXIT_INVALID_PARAM_DEFAULT_OPTION_REPEATED
  603.                 Exit Function 
  604.              End If 
  605.  
  606.             If Not component.getArguments(L_Range_Text,strRange, intArgIter,TRUE) Then
  607.                 intParseCmdLine = CONST_ERROR
  608.                 Exit Function
  609.             End If
  610.  
  611.                 blnRange  =True
  612.                 intArgIter = intArgIter + 1
  613.  
  614.             Case LCase(OPTION_NOHEADER)
  615.  
  616.                   'If more than  1 time(s) is spcecified
  617.                If  blnNoHeader  =True   Then
  618.                  component.vbPrintf InvalidSyntaxMoreNoRepeatedErrorMessage, Array(Wscript.arguments.Item(intArgIter), Ucase(Wscript.ScriptName))
  619.                 intParseCmdLine = EXIT_INVALID_PARAM_DEFAULT_OPTION_REPEATED
  620.                 Exit Function 
  621.                End If 
  622.  
  623.                 blnNoHeader   = TRUE
  624.                        intArgIter = intArgIter + 1
  625.     
  626.             Case LCase(OPTION_VERBOSE)
  627.  
  628.                     'If more than  1 time(s) is spcecified
  629.              If  blnVerboseDisplay  =True   Then
  630.                 component.vbPrintf InvalidSyntaxMoreNoRepeatedErrorMessage, Array(Wscript.arguments.Item(intArgIter), Ucase(Wscript.ScriptName))
  631.                 intParseCmdLine = EXIT_INVALID_PARAM_DEFAULT_OPTION_REPEATED
  632.                 Exit Function 
  633.              End If 
  634.  
  635.                  blnVerboseDisplay = TRUE
  636.                  intArgIter = intArgIter + 1
  637.  
  638.             Case LCase(OPTION_FILTER)
  639.  
  640.             If Not component.getArguments(L_Filter_Text, strTemp, intArgIter, FALSE) Then
  641.                 intParseCmdLine = CONST_ERROR
  642.                 Exit Function
  643.             End If
  644.  
  645.                 arrFilters(intFilterCount) = strTemp
  646.                 intFilterCount = intFilterCount + 1
  647.                 intArgIter = intArgIter + 1
  648.  
  649.                 If ((intFilterCount MOD 5) = 0) Then
  650.                     ReDim PRESERVE arrFilters(intFilterCount + 5)
  651.                 End If
  652.  
  653.             Case LCase(OPTION_HELP)
  654.   
  655.             If  blnHelp  =True   then
  656.                     intParseCmdLine = EXIT_INVALID_PARAM
  657.                     Exit Function 
  658.                 End If 
  659.  
  660.             blnHelp  =True
  661.             intParseCmdLine = CONST_SHOW_USAGE
  662.             intArgIter = intArgIter + 1
  663.  
  664.             Case LCase(OPTION_LOGNAME)
  665.             If Not component.getArguments(L_Log_Text, strTemp, intArgIter, FALSE) Then
  666.                 intParseCmdLine = CONST_ERROR
  667.                 Exit Function
  668.             Else
  669.                 If NOT objLogs.Exists(LCase(strTemp)) Then
  670.                     objLogs.Add LCase(strTemp), -1
  671.                 End If
  672.                     intArgIter = intArgIter + 1
  673.             End if
  674.  
  675.             Case Else
  676.                     ' invalid   switch specified 
  677.                     component.vbPrintf InvalidParameterErrorMessage, Array(Wscript.arguments.Item(intArgIter),Ucase(Wscript.ScriptName))
  678.                     Wscript.Quit(EXIT_INVALID_INPUT)
  679.           
  680.             End Select
  681. Else      
  682.                 ' invalid argument  specified  
  683.         component.vbPrintf InvalidParameterErrorMessage, Array(Wscript.arguments.Item(intArgIter),Ucase(Wscript.ScriptName))
  684.         Wscript.Quit(EXIT_INVALID_INPUT)
  685. End  IF         
  686.  
  687. Loop '** intArgIter <= Wscript.arguments.Count - 1
  688.     
  689.     ' preserving the array with current dimension
  690.     ReDim PRESERVE arrFilters(intFilterCount-1)
  691.  
  692.     ' if no logs specified for query
  693.     If (ObjLogs.Count = 0 ) Then
  694.           ObjLogs.Add "*", -1
  695.     End If  
  696.     
  697.     ' check for invalid usage of help   
  698.     If  blnHelp and  intArgIter > 1     Then    
  699.         intParseCmdLine = CONST_ERROR_USAGE
  700.         Exit Function 
  701.     End If
  702.  
  703.     'check  with default case : no  arguments specified 
  704.     If IsEmpty(intParseCmdLine) Then 
  705.         intParseCmdLine = CONST_PROCEED
  706.     End If
  707.  
  708. End Function
  709.  
  710. '********************************************************************
  711. '* Function: ValidateArguments
  712. '*
  713. '* Purpose:  Validates the command line arguments given by the user
  714. '*
  715. '* Input:
  716. '*  [in]    strMachine         machine to query events from
  717. '*  [in]    strUserName        user name to connect to the machine
  718. '*  [in]    strPassword        password for the user
  719. '*  [in]    strFormat          the display format
  720. '*  [in]    strRange           the range of records required
  721. '*  [in]    blnNoHeader        flag to verify if noheader display is needed  
  722. '*  [out]   arrFilters         the array containing the filters
  723. '*
  724. '* Output:   Returns true if all valid else displays error message and quits
  725. '*           Gets the password from the user if not specified along with User.
  726. '*
  727. '********************************************************************
  728. Private Function ValidateArguments (ByVal strMachine, _
  729.                                     ByVal strUserName, _
  730.                                     ByVal strPassword, _
  731.                                     ByRef arrFilters, _
  732.                                     ByVal strFormat, _
  733.                                     ByVal strRange,_
  734.                                     ByVal blnNoHeader)
  735.  
  736.     ON ERROR RESUME NEXT
  737.     Err.Clear
  738.  
  739.       Dim arrTemp                     ' to store temporary array values
  740.  
  741.      ' Check if invalid Server name is given  
  742.     If   NOT  ISEMPTY(strMachine)  THEN
  743.             If Trim(strMachine) =  vbNullString  Then
  744.                 WScript.Echo (L_InValidServerName_ErrorMessage)
  745.                 WScript.Quit(EXIT_INVALID_INPUT) 
  746.             End If
  747.     End If 
  748.  
  749.     'Check if invalid User name is given 
  750.      If   NOT  ISEMPTY(strUserName)  THEN
  751.              If Trim(strUserName) =  vbNullString  Then
  752.                 WScript.Echo (L_InValidUserName_ErrorMessage )
  753.                 WScript.Quit(EXIT_INVALID_INPUT)
  754.             End If 
  755.      End If
  756.  
  757.     ' ERROR if user is given without machine OR
  758.     '          password is given without user
  759.         If ((strUserName <> VBEmpty) AND (strMachine = VBEmpty)) Then
  760.              component.vbPrintf InvalidCredentialsForServerErrorMessage, Array(Ucase(Wscript.ScriptName))
  761.             WScript.Quit(EXIT_INVALID_INPUT)
  762.         ElseIf  ((strPassword <> VBEmpty) AND (strUserName = VBEmpty))Then
  763.             component.vbPrintf InvalidCredentialsForUserErrorMessage, Array(Ucase(Wscript.ScriptName))
  764.             WScript.Quit(EXIT_INVALID_INPUT)
  765.         End If
  766.  
  767.     ' only table, list and csv display formats allowed
  768.     ' PATTERNFORMAT   '"^(table|list|csv)$"
  769.     
  770.     If CInt(component.matchPattern(PATTERNFORMAT,strFormat)) = CONST_NO_MATCHES_FOUND Then
  771.         component.vbPrintf InvalidFormatErrormessage, Array(strFormat ,Ucase(Wscript.ScriptName))
  772.         WScript.Quit(EXIT_INVALID_INPUT)
  773.     End If 
  774.  
  775.       '  check : -n  header is specified  for  format of  'LIST' option   
  776.     If   blnNoHeader =True  and    Lcase(strFormat) =  Lcase(Const_List_Format_Text) then
  777.         WScript.Echo (L_NoHeaderaNotApplicable_ErrorMessage)
  778.         WScript.Quit(EXIT_INVALID_INPUT)
  779.         End If 
  780.  
  781.     If Len(Trim(strRange)) > 0 Then
  782.         ' range is specified, valid formats are N, -N or N1-N2
  783.         ' PATTERN_RANGE    '"^(\d+|\-\d+|\d+\-\d+)$"
  784.         If CInt(component.matchPattern(PATTERN_RANGE, strRange)) = CONST_NO_MATCHES_FOUND Then
  785.             component.vbPrintf L_InvalidRange_ErrorMessage, Array(strRange)
  786.             WScript.Quit(EXIT_INVALID_INPUT)
  787.         Else
  788.  
  789.             strRange = CLng(Abs(strRange)) 
  790.  
  791.                     'this err an be trappped when N1-N2 option is given     
  792.             If Err.Number Then
  793.                 arrTemp =   split(strRange, "-", 2, VBBinaryCompare)
  794.                 If CLng(arrTemp(0)) => CLng(arrTemp(1)) Then
  795.                     ' invalid range
  796.                     component.vbPrintf L_InvalidRange_ErrorMessage, Array(strRange)
  797.                     WScript.Quit(EXIT_INVALID_INPUT)
  798.                 End If
  799.                     Err.Clear 'if no invalid range  N1-N2  clear the error 
  800.             Else
  801.                 If Abs(strRange) = 0 Then
  802.                     component.vbPrintf L_InvalidRange_ErrorMessage, Array(strRange)
  803.                     WScript.Quit(EXIT_INVALID_INPUT)
  804.                 End If
  805.             End If
  806.         End If
  807.     End If
  808.  
  809.     ValidateArguments = TRUE
  810. End Function
  811.  
  812. '********************************************************************
  813. '* Function: ValidateFilters
  814. '*
  815. '* Purpose:  Validates the filters given by the user.
  816. '*
  817. '* Input:    [in]  Objservice     the WMI service object
  818. '* Input:    [out] arrFilters     the array containing the filters
  819. '*
  820. '* Output:   If filter is invalid, displays error message and quits
  821. '*           If valid, filter is prepared for the query and returns true
  822. '*
  823. '********************************************************************
  824. Private Function ValidateFilters(ByRef arrFilters ,ByVal ObjService)
  825.  
  826.     ON ERROR RESUME NEXT
  827.     Err.Clear
  828.  
  829.     Dim  j                  ' to use in the loop
  830.     Dim strFilter          ' to store the user given filter (Eg:"Type eq Error")
  831.     Dim arrTempProp        ' to store the temporary array filterproperty 
  832.     Dim arrTempOperAndVal  ' to store the temporary array filteroperator and filtervalue 
  833.     Dim strTemp            ' to store temporary values
  834.     Dim arrTemp            ' to store temporary values of datetime when Range is given (Date1-Date2) 
  835.     Dim strFilterProperty  ' the filter criteria that is specified (Eg:Type, ID)
  836.     Dim strFilterOperation ' the operation specified (Eg: eq, gt)
  837.     Dim strFilterValue     ' the filter value specified
  838.  
  839.     Dim objInstance        ' to refer to the instances of the objEnumerator
  840.     Dim objEnumerator      ' to store the results of the query is executed 
  841.         Dim strTempQuery       ' string to make query  
  842.     Dim strTimeZone        ' to store the TimeZone  of the Queried system 
  843.     Dim strSign            ' to store "+|-" sign value of TimeZone 
  844.  
  845.     ' validate each filter stored in the array
  846.     For j = 0 to UBound(arrFilters)
  847.         strFilter = arrFilters(j)
  848.         
  849.         'check eigther  "OR or AND" is present inthe filter value  
  850.         'Example  :  "type  eq warning  " OR "  type eq error"    [to support (OR + AND) ing   in Filter Switch]
  851.         'Make a flag in this case  "OR or AND" is present/not  
  852.         'split it by "OR or AND " SEND   as No. of   Array elements
  853.         Dim  blnOR                 'boolean to refer  'OR' operation is specified
  854.         Dim  blnAND              'boolean to refer  'AND' operation is specified
  855.         Dim  strArrFilter       'string to store array of filters if  OR or AND  is specified 
  856.  
  857.         blnOR  =False       'Initialise to False
  858.         blnAND=False       'Initialise to False
  859.  
  860.       If   UBOUND(Split(LCase(strFilter),LCase(L_OperatorOR_Text)) ) > 0  Then
  861.  
  862.           ' Check if  filter have more no of OR  with any AND   Option(s) 
  863.         If UBOUND(Split(LCase(strFilter),LCase(L_OperatorOR_Text)) )  > 1 Or  _
  864.                   UBOUND(Split(LCase(strFilter),LCase(L_OperatorAND_Text)) ) >0  Then
  865.             component.vbPrintf L_InvalidFilterFormat_ErrorMessage, Array(strFilter)
  866.             WScript.Quit(EXIT_INVALID_INPUT)
  867.         End If
  868.  
  869.            'setting the flag if " OR " specified in filter
  870.              blnOR =TRUE
  871.  
  872.             'split with "OR"    
  873.              strArrFilter =  Split(LCase(strFilter),LCase(L_OperatorOR_Text))
  874.  
  875.       ElseIf UBOUND(Split(LCase(strFilter),LCase(L_OperatorAND_Text)) ) > 0  Then
  876.  
  877.         ' Check if  filter have more no of AND with OR Option(s) 
  878.         If UBOUND(Split(LCase(strFilter),LCase(L_OperatorAND_Text)) )  > 1  Or  _
  879.                  UBOUND(Split(LCase(strFilter),LCase(L_OperatorOR_Text)) ) > 0  Then
  880.             component.vbPrintf L_InvalidFilterFormat_ErrorMessage, Array(strFilter)
  881.             WScript.Quit(EXIT_INVALID_INPUT)
  882.         End If
  883.  
  884.            'setting the flag if " AND " specified in filter
  885.              blnAND =TRUE
  886.  
  887.             'split with "AND"    
  888.              strArrFilter =  Split(LCase(strFilter),LCase(L_OperatorAND_Text))
  889.        Else
  890.                 'make single dimension array   UBOUND = 0  
  891.                 strArrFilter = Array(strFilter)
  892.        End If
  893.        
  894.         Dim k       '  to use in the loop
  895.         Dim  strTempFilter ' used to format Query string    
  896.  
  897.         'process  the array for validatation 
  898.         'UBOUND = 0  say normal filter specified      
  899.         For k = 0 to UBound(strArrFilter) 
  900.  
  901.             If   UBound(strArrFilter) > 0 then
  902.                  strFilter =strArrFilter(k)
  903.             Else
  904.                     'this is the first element  allways
  905.                   strFilter =strArrFilter(0)
  906.             End If 
  907.  
  908.          ' check if 3 parameters are passed as input to filter
  909.         ' PATTERN_FILTER  "^([a-z]+)([\s]+)([a-z]+)([\s]+)(\w+)"
  910.  
  911.         strFilter = Trim( strFilter )               ' trim the value
  912.         If CInt(component.matchPattern(PATTERN_FILTER, strFilter)) <= 0 Then
  913.             component.vbPrintf L_InvalidFilterFormat_ErrorMessage, Array(strFilter)
  914.             WScript.Quit(EXIT_INVALID_INPUT)
  915.         End If
  916.  
  917.                  
  918.             ' This is to eliminate any no.of blank Char(s) between three valid input values 
  919.             ' i.e..filter "property ---operation ----value" 
  920.             ' first  SPLIT the space delimiter string into array size of 2.
  921.             ' and get the property value 
  922.             arrTempProp = split(Trim(strFilter)," ",2,VBBinaryCompare)
  923.             strFilterProperty  = arrTempProp(0)
  924.  
  925.             ' now trim it and again  SPLIT the second element of arrTempProp into an array of size 2.
  926.             ' and get the operation and value  
  927.             arrTempOperAndVal   = split(Trim(arrTempProp(1))," ",2,VBBinaryCompare)
  928.             strFilterOperation  = arrTempOperAndVal(0)
  929.             strFilterValue      = Ltrim(arrTempOperAndVal(1))
  930.             
  931.             If LCase(strFilterProperty) = LCase(L_UserFilterDateTime_Text) OR _
  932.                 LCase(strFilterProperty) = LCase(L_UserFilterId_Text) Then
  933.                 ' the following are valid operators
  934.                 If LCase(strFilterOperation) = LCase(L_OperatorEq_Text)  OR _
  935.                     LCase(strFilterOperation) = LCase(L_OperatorNe_Text) OR _
  936.                     LCase(strFilterOperation) = LCase(L_OperatorGe_Text) OR _
  937.                     LCase(strFilterOperation) = LCase(L_OperatorLe_Text) OR _
  938.                     LCase(strFilterOperation) = LCase(L_OperatorGt_Text) OR _
  939.                     LCase(strFilterOperation) = LCase(L_OperatorLt_Text) Then
  940.                     
  941.                     strTemp = ReplaceOperators(strFilterOperation)
  942.                     strFilterOperation = strTemp
  943.                 Else
  944.                     component.vbPrintf L_InvalidFilterOperation_ErrorMessage, Array(strFilterOperation, strFilter)
  945.                     WScript.Quit(EXIT_INVALID_INPUT)
  946.                 End If
  947.                 
  948.             ElseIf LCase(strFilterProperty) = LCase(L_UserFilterType_Text) OR _
  949.                     LCase(strFilterProperty) = LCase(L_UserFilterUser_Text) OR _
  950.                      LCase(strFilterProperty) = LCase(L_UserFilterComputer_Text) OR _
  951.                     LCase(strFilterProperty) = LCase(L_UserFilterSource_Text) OR _
  952.                     LCase(strFilterProperty) = LCase(L_UserFilterDateCategory_Text) Then
  953.                 ' for others, only these two operators are valid
  954.                 If LCase(strFilterOperation) = LCase(L_OperatorEq_Text) OR _
  955.                     LCase(strFilterOperation) = LCase(L_OperatorNe_Text) Then
  956.                     
  957.                     strTemp = ReplaceOperators(strFilterOperation)
  958.                     strFilterOperation = strTemp
  959.                 Else
  960.                     component.vbPrintf L_InvalidFilterOperation_ErrorMessage, _
  961.                             Array(strFilterOperation, strFilter)
  962.                         WScript.Quit(EXIT_INVALID_INPUT)
  963.                 End If
  964.             Else
  965.                     component.vbPrintf L_InvalidFilterOperation_ErrorMessage, _
  966.                     Array(strFilterProperty, strFilter)
  967.                     WScript.Quit(EXIT_INVALID_INPUT)
  968.             End If
  969.                 
  970.             ' validate the filter asked for
  971.             Select Case LCase(strFilterProperty)
  972.             
  973.                 Case L_UserFilterDateTime_Text
  974.                 
  975.                 'Checking  " OR " is only supported property  EQ "TYPE OR ID" only 
  976.                 If  blnOR = True then
  977.                            WScript.Echo  InvalidORSyntaxInFilterErrorMessage
  978.                            WScript.Quit(EXIT_INVALID_INPUT)
  979.                 End If
  980.  
  981.                     ' Here To find Time Zone of system from   CLASS_TIMEZONE_FILE 
  982.                      strTempQuery = "SELECT *  FROM Win32_OperatingSystem " 
  983.  
  984.                     Set objEnumerator = objService.ExecQuery(strTempQuery,,0)
  985.  
  986.                             ' getting the  Time Zone    
  987.                     For each objInstance in objEnumerator
  988.                              strTimeZone = objInstance.CurrentTimeZone  
  989.                     Next
  990.  
  991.                     'here to format timeZome value as '+/-' UUU 
  992.  
  993.                         If Isnull(strTimeZone) or IsEmpty(strTimeZone)then
  994.                              strTimeZone =0
  995.                         End If 
  996.  
  997.                         'default sign   
  998.                         strSign ="+"     
  999.                     
  1000.                         IF  strTimeZone < 0  THEN
  1001.                              strSign ="-"
  1002.                         End If    
  1003.                     
  1004.                         If Len(strTimeZone) < 4 then
  1005.                              If Len(strTimeZone) = 3 then
  1006.                                      If strTimeZone < 0 then 
  1007.                                              strTimeZone = Replace(strTimeZone,"-","0")    
  1008.                                      End If
  1009.                              ElseIf Len(strTimeZone) = 2 then
  1010.                                      If strTimeZone < 0 then
  1011.                                             strTimeZone = Replace(strTimeZone,"-","00")    
  1012.                                      Else
  1013.                                             strTimeZone = "0" & strTimeZone     
  1014.                                     End If            
  1015.                              ElseIf Len(strTimeZone) = 1 then
  1016.                                        IF  strTimeZone >= 0  Then
  1017.                                             strTimeZone = "00" & strTimeZone     
  1018.                                        End if 
  1019.                               End If   
  1020.                                          'return to a format  as  "+|-" & UUU 
  1021.                              strTimeZone= strSign & strTimeZone          
  1022.                          End If
  1023.  
  1024.                     ' check for the valid format - MM/dd/yy,hh:mm:ssPM
  1025.                     ' PATTERN_DATETIME 
  1026.                     If CInt(component.matchPattern(PATTERN_DATETIME, strFilterValue)) > 0 Then
  1027.                         If component.validateDateTime(strFilterValue) Then
  1028.                             ' a valid datetime filter. Prepare for query
  1029.                                 strFilterProperty = FLD_FILTER_DATETIME
  1030.                                 strTemp = component.changeToWMIDateTime(strFilterValue,strTimeZone)
  1031.                                 ' Format the input 
  1032.                                 ' TimeGenerated > "07/25/2000 10:12:00 PM"
  1033.                                 strFilterValue = Chr(34) & strTemp & Chr(34)
  1034.                         End If
  1035.                     Else
  1036.                         ' match for range of dates in the format 
  1037.                         ' MM/dd/yy,hh:mm:ssPM - MM/dd/yy,hh:mm:ssAM
  1038.                         ' PATTERN_DATETIME_RANGE 
  1039.         
  1040.                         If CInt(component.matchPattern(PATTERN_DATETIME_RANGE, strFilterValue)) > 0 Then
  1041.                             strFilterProperty = FLD_FILTER_DATETIME
  1042.                             ' Only = operation supported in this format
  1043.                             If strFilterOperation <> "=" Then
  1044.                                 WScript.Echo (L_InvalidOperator_ErrorMessage)
  1045.                                 WScript.Quit(EXIT_INVALID_INPUT)
  1046.                             End If
  1047.                     
  1048.                             arrTemp = split(strFilterValue,"-",2,VBBinaryCompare)
  1049.  
  1050.                             If component.validateDateTime(arrTemp(0)) Then
  1051.                                     ' a valid datetime filter. Prepare for query
  1052.                                     strTemp = component.changeToWMIDateTime(arrTemp(0),strTimeZone)
  1053.                                     ' Format the input 
  1054.                                     ' TimeGenerated > "07/04/2002 10:12:00 PM"
  1055.                                     strFilterOperation = ">="
  1056.                                     strFilterValue = Chr(34) & strTemp & Chr(34)
  1057.  
  1058.                                     If component.validateDateTime(arrTemp(1)) Then
  1059.                                         ' a valid datetime filter. Prepare for query
  1060.                                         strTemp = component.changeToWMIDateTime(arrTemp(1),strTimeZone)
  1061.                                         ' Format the input 
  1062.                                         ' TimeGenerated > "07/04/2002 10:12:00 PM"
  1063.                                         strFilterValue = strFilterValue & _
  1064.                                         " AND " & strFilterProperty & "<="& Chr(34)_
  1065.                                         & strTemp & Chr(34)
  1066.                                     End If
  1067.                                 End If
  1068.                             Else
  1069.                                 component.vbPrintf L_InvalidDateTimeFormat_ErrorMessage, Array(strFilter)
  1070.                                 WScript.Quit(EXIT_INVALID_INPUT)
  1071.                             End If
  1072.                         End If
  1073.  
  1074.                 Case L_UserFilterType_Text
  1075.                 
  1076.                         ' the following values are only valid for the "Type" filter
  1077.                         ' Valid: ERROR|INFORMATION|WARNING|SUCCESSAUDIT|FAILUREAUDIT
  1078.                         ' PATTERNTYPE 
  1079.  
  1080.                         If CInt(component.matchPattern(PATTERNTYPE, strFilterValue)) = _
  1081.                                                     CONST_NO_MATCHES_FOUND Then
  1082.                             component.vbPrintf L_InvalidType_ErrorMessage, Array(strFilterValue, strFilter)
  1083.                             WScript.Quit(EXIT_INVALID_INPUT)
  1084.                         Else
  1085.         '                        here we need to check if running on WINXP or not
  1086.                                  If  ( IsWinXP ( ObjService) = TRUE ) Then 
  1087.                                     
  1088.                                            ' a valid type filter. Prepare for query
  1089.                                             If LCase(strFilterValue) =LCase(PATTERNTYPE_ERROR) Then
  1090.                                                 strFilterValue  = EVENTTYPE_ERROR
  1091.                                             ElseIf LCase(strFilterValue) =LCase(PATTERNTYPE_WARNING) Then
  1092.                                                 strFilterValue  = EVENTTYPE_WARNING
  1093.                                             ElseIf LCase(strFilterValue) =LCase(PATTERNTYPE_INFORMATION) Then
  1094.                                                 strFilterValue  = EVENTTYPE_INFORMATION
  1095.                                             ElseIf LCase(strFilterValue) =LCase(PATTERNTYPE_SUCCESSAUDIT) Then
  1096.                                                 strFilterValue  = EVENTTYPE_SUCCESSAUDIT
  1097.                                             ElseIf  LCase(strFilterValue) =LCase(PATTERNTYPE_FAILUREAUDIT) Then
  1098.                                                 strFilterValue  = EVENTTYPE_FAILUREAUDIT
  1099.                                            ElseIf  LCase(strFilterValue) =LCase(PATTERNTYPE_SUCCESS) Then
  1100.                                                 strFilterValue  = EVENTTYPE_SUCCESS
  1101.                                             End If 
  1102.                                             ' a valid type filter. Prepare for query
  1103.                                             strFilterProperty = FLD_FILTER_EVENTTYPE
  1104.                                   Else 
  1105.  
  1106.                                         If LCase(strFilterValue) =LCase(PATTERNTYPE_SUCCESSAUDIT) Then
  1107.                                             strFilterValue  = FLDFILTERTYPE_SUCCESSAUDIT
  1108.                                         ElseIf  LCase(strFilterValue) =LCase(PATTERNTYPE_FAILUREAUDIT) Then
  1109.                                             strFilterValue  = FLDFILTERTYPE_FAILUREAUDIT
  1110.                                         End If 
  1111.  
  1112.                                         ' a valid type filter. Prepare for query
  1113.                                         strFilterProperty = FLD_FILTER_TYPE
  1114.                                         
  1115.                                   End If 
  1116.  
  1117.                         End If
  1118.  
  1119.                 Case L_UserFilterUser_Text
  1120.  
  1121.                'Checking  " OR " is only supported property  EQ "TYPE OR ID" only 
  1122.                 If  blnOR  = True  then
  1123.                            WScript.Echo  InvalidORSyntaxInFilterErrorMessage
  1124.                            WScript.Quit(EXIT_INVALID_INPUT)
  1125.                 End If
  1126.  
  1127.                         ' these are invalid characters for a user name
  1128.                         ' PATTERN_INVALID_USER
  1129.         
  1130.                         If CInt(component.matchPattern(PATTERN_INVALID_USER, strFilterValue)) > 0 Then
  1131.                             component.vbPrintf L_InvalidUser_ErrorMessage , Array(strFilterValue, strFilter)
  1132.                             WScript.Quit(EXIT_INVALID_INPUT)
  1133.                         Else
  1134.                             
  1135.                             ' a valid user filter. Prepare for query
  1136.                             If InStr(1, strFilterValue, "\", VBBinaryCompare) Then
  1137.                                 strFilterValue = Replace(strFilterValue, "\","\\")
  1138.                             End If
  1139.                             
  1140.                             If LCase(strFilterValue) =LCase(L_TextNa_Text) Then
  1141.                                 strFilterValue  = Null
  1142.                             End If      
  1143.  
  1144.                         End If
  1145.                         strFilterProperty = FLD_FILTER_USER
  1146.  
  1147.                 Case L_UserFilterComputer_Text
  1148.                             ' a valid computer filter. Prepare for query
  1149.                             strFilterProperty = FLD_FILTER_COMPUTER
  1150.  
  1151.                'Checking  " OR " is only supported property  EQ "TYPE OR ID" only 
  1152.                 If  blnOR  = True then
  1153.                            WScript.Echo  InvalidORSyntaxInFilterErrorMessage
  1154.                            WScript.Quit(EXIT_INVALID_INPUT)
  1155.                 End If
  1156.  
  1157.                 Case L_UserFilterSource_Text
  1158.                             ' a valid Source filter. Prepare for query
  1159.                             strFilterProperty = FLD_FILTER_SOURCE
  1160.  
  1161.                'Checking  " OR " is only supported property  EQ "TYPE OR ID" only 
  1162.                 If  blnOR  = True then
  1163.                            WScript.Echo  InvalidORSyntaxInFilterErrorMessage
  1164.                            WScript.Quit(EXIT_INVALID_INPUT)
  1165.                 End If
  1166.  
  1167.                 Case L_UserFilterDateCategory_Text
  1168.  
  1169.                'Checking  " OR " is only supported property  EQ "TYPE OR ID" only 
  1170.                 If  blnOR  = True then
  1171.                            WScript.Echo  InvalidORSyntaxInFilterErrorMessage
  1172.                            WScript.Quit(EXIT_INVALID_INPUT)
  1173.                 End If
  1174.                 
  1175.                             ' a valid Category filter. Prepare for query
  1176.                             If LCase(strFilterValue) =LCase(L_TextNone_Text) Then
  1177.                                 strFilterValue  = Null
  1178.                             End If 
  1179.  
  1180.                              strFilterProperty = FLD_FILTER_CATEGORY 
  1181.                     
  1182.                 Case L_UserFilterId_Text
  1183.                         ' check if the given id is a number
  1184.                         ' PATTERN_ID '"^(\d+)$"
  1185.                         If CInt(component.matchPattern(PATTERN_ID, strFilterValue)) = CONST_NO_MATCHES_FOUND Then
  1186.                             component.vbPrintf L_InvalidId_ErrorMessage, Array(strFilterValue, strFilter)
  1187.                             WScript.Quit(EXIT_INVALID_INPUT)
  1188.                         Else
  1189.                             ' Invalid ID Number  validation     
  1190.                             If  ( Clng(strFilterValue)   >  CONST_ID_NUMBER )Then     
  1191.                                 component.vbPrintf L_InvalidId_ErrorMessage, Array(strFilterValue, strFilter)
  1192.                                 WScript.Quit(EXIT_INVALID_INPUT)
  1193.                             End If
  1194.  
  1195.                             ' a  valid id filter. Prepare for query
  1196.                             strFilterProperty = FLD_FILTER_ID
  1197.                         End If
  1198.  
  1199.                 Case Else 
  1200.                         ' invalid filter specified
  1201.                         component.vbPrintf L_InvalidFilter_ErrorMessage, Array(strFilterProperty, strFilter)
  1202.                         WScript.Quit(EXIT_INVALID_INPUT)
  1203.             End Select
  1204.  
  1205.             If LCase(strFilterProperty) = LCase(FLD_FILTER_DATETIME) OR IsNull(strFilterValue) Then
  1206.                 ' This is to handle NULL WMI property values i.e in category or type          
  1207.                 If   IsNull(strFilterValue) Then
  1208.                  strFilter = strFilterProperty & strFilterOperation & strFilterValue & "Null"
  1209.                 Else
  1210.                  strFilter = strFilterProperty & strFilterOperation & strFilterValue  
  1211.                 End If 
  1212.                 
  1213.             Else
  1214.                 strFilter = strFilterProperty & _
  1215.                             strFilterOperation & Chr(34) & strFilterValue & Chr(34)
  1216.             End If
  1217.  
  1218.         'Binding the string with "OR or AND " to Prepare for query if blnOR or blnAND is TRUE
  1219.         If blnOR =TRUE Then
  1220.  
  1221.             If k =  0 then  
  1222.                         strTempFilter = strFilter 
  1223.             Else
  1224.                         strTempFilter = strTempFilter  &  " OR " &  strFilter
  1225.             End If 
  1226.  
  1227.         ElseIf   blnAND =TRUE Then
  1228.  
  1229.             If k =  0 then  
  1230.                         strTempFilter = strFilter 
  1231.             Else
  1232.                         strTempFilter = strTempFilter  &  " AND " &  strFilter
  1233.             End If 
  1234.         
  1235.         End If 
  1236.  
  1237.     Next  
  1238.  
  1239.         'Set again making single filter string element if blnOR is TRUE 
  1240.           If blnOR =TRUE or blnAND = True   Then
  1241.                 'this  "()" Add  the order of precedence of operation is SQL 
  1242.                  strFilter = "( " & strTempFilter & ")"
  1243.         End If
  1244.  
  1245.     'Here setting filter to main array
  1246.          arrFilters(j) = strFilter
  1247.  
  1248.  
  1249.     Next
  1250.  
  1251.     ValidateFilters = TRUE
  1252.  
  1253. End Function
  1254.  
  1255. '********************************************************************
  1256. '* Function: ReplaceOperators
  1257. '*
  1258. '* Purpose:  Replaces the operator in string form with its symbol
  1259. '*
  1260. '* Input:   
  1261. '*       [in]    strFilterOperation     the operation
  1262. '*
  1263. '* Output:   Returns the symbolic operator
  1264. '*           If invalid operator, displays error message and quits
  1265. '*
  1266. '********************************************************************
  1267. Private Function ReplaceOperators(ByVal strFilterOperation)
  1268.     ON ERROR RESUME NEXT
  1269.     Err.Clear
  1270.  
  1271.     Select Case LCase(strFilterOperation)
  1272.  
  1273.         Case L_OperatorEq_Text
  1274.                     ReplaceOperators = SYMBOL_OPERATOR_EQ
  1275.  
  1276.         Case L_OperatorNe_Text
  1277.                     ReplaceOperators = SYMBOL_OPERATOR_NE
  1278.  
  1279.         Case L_OperatorGe_Text
  1280.                     ReplaceOperators = SYMBOL_OPERATOR_GE
  1281.  
  1282.         Case L_OperatorLe_Text
  1283.                     ReplaceOperators = SYMBOL_OPERATOR_LE
  1284.  
  1285.         Case L_OperatorGt_Text
  1286.                     ReplaceOperators = SYMBOL_OPERATOR_GT
  1287.  
  1288.         Case L_OperatorLt_Text
  1289.                     ReplaceOperators = SYMBOL_OPERATOR_LT
  1290.  
  1291.         Case Else
  1292.                 ' not a valid operator
  1293.                 component.vbPrintf L_Invalid_ErrorMessage, Array(strFilterOperation)
  1294.                 WScript.Quit(EXIT_INVALID_PARAM)
  1295.     End Select
  1296. End Function
  1297. '********************************************************************
  1298. '* Sub : VerifyLogAndGetMaxRecords
  1299. '*
  1300. '* Purpose:  populates the output array  with count of records in given  input array
  1301. '*
  1302. '* Input:    [in]  objService        the WMI service object
  1303. '*           [out] objLogs           the object containing the logs & max count of records corresponding log
  1304. '*
  1305. '* Output:   array's  are  populates with logfile names and its count of  max records
  1306. '*
  1307. '********************************************************************
  1308. Private Sub VerifyLogAndGetMaxRecords(ByVal objService, _
  1309.                  ByRef objLogs)
  1310.  
  1311.     ON ERROR RESUME NEXT
  1312.     Err.Clear
  1313.     
  1314.     Dim strTempQuery     ' string to make query  
  1315.     Dim objEnumerator    ' to get the collection object after query
  1316.     Dim objInstance      ' to refer to each instance of the results got
  1317.     Dim i                ' for  initialing  loop
  1318.     Dim strLogFile       ' used to   store log file  inside loop  
  1319.     Dim arrKeyName       ' used to store key value of Dictionary object for processing loop   
  1320.  
  1321.     arrKeyName = objLogs.Keys
  1322.  
  1323.     For i = 0  to  objLogs.Count -1 
  1324.         strLogFile = arrKeyName(i)
  1325.         If Not strLogFile = "*" Then
  1326.             ' Check if log file exists, by querying 
  1327.             strTempQuery = "SELECT NumberOfRecords FROM Win32_NTEventlogFile " &_
  1328.                             "WHERE LogfileName=" & Chr(34) & strLogFile & Chr(34)
  1329.  
  1330.             Set objEnumerator = objService.ExecQuery(strTempQuery,,0)
  1331.  
  1332.             If Err.Number Then
  1333.                 component.vbPrintf L_ExecuteQuery_ErrorMessage, Array(strLogFile)
  1334.                 WScript.Quit(EXIT_METHOD_FAIL)
  1335.             End If
  1336.  
  1337.             ' check if given log is present
  1338.             If ObjEnumerator.Count <> 1 Then
  1339.                 component.vbPrintf L_LogDoesNotExist_ErrorMessage, Array(strLogFile)
  1340.                 'If  Count of Logs = 1  Quit  Here 
  1341.                 If objLogs.Count= 1 Then
  1342.                      WScript.Quit(EXIT_INVALID_INPUT)
  1343.                End If  
  1344.                'If more proceed ..
  1345.                 objLogs.Remove(strLogFile)
  1346.             Else
  1347.                 ' get maximum number of records in that log(used if range specified)
  1348.                 For each objInstance in objEnumerator
  1349.                     If objInstance.NumberOfRecords <> "" Then
  1350.                         objLogs.Item(strLogFile) = objInstance.NumberOfRecords
  1351.                     Else
  1352.                         objLogs.Item(strLogFile) = 0
  1353.                     End If
  1354.                 Next
  1355.             End If
  1356.             Set ObjEnumerator = Nothing
  1357.         End If
  1358.     Next
  1359.  
  1360.     If objLogs.Exists("*") Then
  1361.         ' if the * is specified, populate array  with elements 
  1362.         objLogs.Remove("*")
  1363.         ' get the instances of the logs present in the system
  1364.         Set objEnumerator = objService.InstancesOf(CLASS_EVENTLOG_FILE)
  1365.         
  1366.          If Err.number  Then
  1367.             Wscript.Echo (L_InstancesFailed_ErrorMessage)
  1368.             WScript.Quit(EXIT_METHOD_FAIL)
  1369.          End If  
  1370.     
  1371.         ' if no logs present
  1372.         If objEnumerator.Count <= 0 Then
  1373.             WScript.Echo (L_InfoNoLogsPresent_Message) 
  1374.             WScript.Quit(EXIT_UNEXPECTED)
  1375.         Else
  1376.             For Each objInstance In objEnumerator
  1377.                 If Not IsEmpty(objInstance.LogfileName) Then
  1378.                             If NOT objLogs.Exists(LCase(objInstance.LogfileName)) Then
  1379.                                 If objInstance.NumberOfRecords Then 
  1380.                                     objLogs.Add LCase(objInstance.LogfileName), objInstance.NumberOfRecords
  1381.                                 Else
  1382.                                     objLogs.Add LCase(objInstance.LogfileName), 0
  1383.                                 End If
  1384.                             End If
  1385.                 End If
  1386.             Next
  1387.         End If
  1388.     End If
  1389.  
  1390. End Sub
  1391.  
  1392. '********************************************************************
  1393. '* Function: BuildFiltersForQuery
  1394. '*
  1395. '* Purpose:  Builds the query with the filter arguments
  1396. '*
  1397. '* Input:    [in] arrFilters    the array containing the filter conditions
  1398. '*
  1399. '* Output:   Returns the string to be concatenated to the main query
  1400. '*
  1401. '********************************************************************
  1402. Function BuildFiltersForQuery(ByVal arrFilters)
  1403.     ON ERROR RESUME NEXT
  1404.     Err.Clear
  1405.  
  1406.     Dim strTempFilter    ' to store the return string
  1407.     Dim i                ' used in loop
  1408.  
  1409.     strTempFilter = ""
  1410.     For i = 0 to UBound(arrFilters)
  1411.             strTempFilter = strTempFilter & " AND "
  1412.             strTempFilter = strTempFilter & arrFilters(i)
  1413.     Next
  1414.      
  1415.     BuildFiltersForQuery = strTempFilter
  1416.  
  1417. End Function 
  1418.  
  1419. '********************************************************************
  1420. '* Function : BuildRangeForQuery
  1421. '*
  1422. '* Purpose:  Builds the range boundaries to display the records.
  1423. '*
  1424. '* Input:   [in] strRange             ' the range specified by the user
  1425. '*                                      Will be in the format N, -N or N-N
  1426. '*          [in]  intFiltersSpecified ' array containing the filters number
  1427. '*          [in]  objService          ' the service object
  1428. '*          [out] intRecordRangeFrom  ' where do we start the display of records?
  1429. '*          [out] intRecordRangeTo    ' where do we stop displaying records
  1430. '*          [out] strFilterLog        ' log file to build query
  1431. '*          [out] strQuery            ' to build query according to given  Range Type 
  1432. '* Output:   Sets the value for the start and end of display boundaries.
  1433. '*
  1434. '********************************************************************
  1435. Private Function BuildRangeForQuery(ByVal strRange, _
  1436.                                ByRef intRecordRangeFrom, _
  1437.                                ByRef intRecordRangeTo,_
  1438.                                ByVal intFiltersSpecified,_
  1439.                                ByRef strQuery,_
  1440.                                ByVal ObjService,_
  1441.                                ByVal strFilterLog )
  1442.  
  1443.     ON ERROR RESUME NEXT
  1444.     Err.Clear
  1445.  
  1446.     Dim intMaxEventRecordsPresent   ' to store the max recods in the log
  1447.     Dim arrRangeValues              ' to store the split values if range is of the type N-N
  1448.     Dim objInstance                 ' to refer to the instances of the objEnumerator
  1449.     Dim objEnumerator               ' to store the results of the query is executed 
  1450.     Dim FilterRecordCount           ' to store the count of records if filter with +N  specified     
  1451.     
  1452.     FilterRecordCount  = 0         
  1453.  
  1454.         BuildRangeForQuery  = strquery    'intialize  
  1455.  
  1456.     Dim currentMaxRecordnumber  'curentMaxrecord number   
  1457.     Dim currentMinRecordnumber  'curentMinrecord number  
  1458.  
  1459.     currentMaxRecordnumber = 0
  1460.     currentMinRecordnumber = 0 
  1461.     
  1462.     ' save the max. no. of records available in the current log
  1463.     intMaxEventRecordsPresent = intRecordRangeTo
  1464.  
  1465.  
  1466.            ' find  the count of events / logfile   if Filter is  specified .
  1467.         If intFiltersSpecified >= 0 Then 
  1468.                     Set objEnumerator = objService.ExecQuery(strQuery,"WQL",0,null)
  1469.                                 If Err.number Then      
  1470.                                     component.vbPrintf L_ExecuteQuery_ErrorMessage, Array(strFilterLog)
  1471.                                     Exit Function 
  1472.                                 End if  
  1473.                                 
  1474.                                 FilterRecordCount= objEnumerator.count
  1475.                 
  1476.                     Set objEnumerator= Nothing  'releases the memory 
  1477.         End If   
  1478.     
  1479.     ' check the type of range specified ( first N / last N /    N1 - N2 )
  1480.     If ( IsNumeric(strRange) ) Then
  1481.  
  1482.         ' range is first N or last N
  1483.         ' now check whether it is first N or last N
  1484.         If strRange < 0  Then
  1485.                             If intFiltersSpecified >= 0 Then
  1486.                                         ' first  N  records   
  1487.                                         ' initial the counter so that all the out is displayed
  1488.                             
  1489.                                             If   FilterRecordCount   >  CLng(Abs(strRange))  then
  1490.                                                     intRecordRangeFrom = FilterRecordCount    -  CLng(Abs(strRange)) + 1 
  1491.                                                     intRecordRangeTo   = FilterRecordCount   
  1492.                                              Else
  1493.                                                     intRecordRangeFrom = 0 
  1494.                                                     intRecordRangeTo   = FilterRecordCount   
  1495.                                             End If 
  1496.  
  1497.                                 Else        
  1498.  
  1499.                                             Set objEnumerator = objService.ExecQuery(strQuery,"WQL",48,null)
  1500.                                                     For Each objInstance  In  objEnumerator
  1501.                                                               currentMaxRecordnumber= objInstance.RecordNumber
  1502.                                                           Exit for 
  1503.                                                     Next
  1504.                                         
  1505.                                             If  currentMaxRecordnumber >   intMaxEventRecordsPresent then
  1506.                                                          currentMinRecordnumber  = currentMaxRecordnumber - intMaxEventRecordsPresent
  1507.                                                         intMaxEventRecordsPresent =  currentMaxRecordnumber         
  1508.                                             End If  
  1509.                                                 Set objEnumerator= Nothing  'releases the memory 
  1510.  
  1511.                                             ' N  means  record number <= N  
  1512.                                             ' initial the counter s+o that all the out is displayed
  1513.                                             ' build the query
  1514.                                              BuildRangeForQuery = strQuery & " AND RecordNumber <= "&   CLng(Abs(strRange))  + currentMinRecordnumber
  1515.                                             
  1516.                                End If 
  1517.                     Else
  1518.                                 ' *** range is last N (i.e -N)
  1519.                                 If intFiltersSpecified >= 0 Then
  1520.  
  1521.                                         If   FilterRecordCount   >  CLng(Abs(strRange))  then
  1522.                                             intRecordRangeFrom =0 
  1523.                                             intRecordRangeTo   =   CLng(Abs(strRange))  
  1524.                                         Else
  1525.                                             intRecordRangeFrom =0 
  1526.                                             intRecordRangeTo   =   FilterRecordCount   
  1527.                                         End If 
  1528.  
  1529.                                 Else
  1530.  
  1531.                                         Set objEnumerator = objService.ExecQuery(strQuery,"WQL",48,null)
  1532.                                                 'getting current max recordnumber  
  1533.                                                 For Each objInstance  In  objEnumerator
  1534.                                                           currentMaxRecordnumber= objInstance.RecordNumber
  1535.                                                       Exit for 
  1536.                                                 Next
  1537.  
  1538.                                         If  currentMaxRecordnumber >   intMaxEventRecordsPresent then
  1539.                                                      currentMinRecordnumber  = currentMaxRecordnumber - intMaxEventRecordsPresent
  1540.                                                     intMaxEventRecordsPresent =  currentMaxRecordnumber         
  1541.                                         End If          
  1542.  
  1543.                                                 Set objEnumerator= Nothing  'releases the memory 
  1544.  
  1545.                                     ' -N  means  record number > (maxNumber - N )
  1546.                                     ' initial the counter so that all the out is displayed
  1547.                                     ' build the query
  1548.                                     If  CLng(Abs(strRange)) >  intMaxEventRecordsPresent Then
  1549.                                         'Show all records  
  1550.                                           BuildRangeForQuery =strQuery &  " AND RecordNumber > 0 "   
  1551.                                     Else 
  1552.                                             BuildRangeForQuery =strQuery &  " AND RecordNumber > " & intMaxEventRecordsPresent - CLng(Abs(strRange))
  1553.                                     End If
  1554.                                 End If
  1555.                     End If
  1556.     Else
  1557.         ' range of records asked for N-N case
  1558.          arrRangeValues = split(strRange,"-", 2, VBBinaryCompare)   
  1559.  
  1560.         If intFiltersSpecified >= 0 Then
  1561.                 If  CLng(arrRangeValues(0)) <   FilterRecordCount then
  1562.                 
  1563.                      ' initial the counter so that all the out is displayed
  1564.                         intRecordRangeFrom = CLng(arrRangeValues(0))  
  1565.                         intRecordRangeTo    = CLng(arrRangeValues(1))
  1566.                 Else 
  1567.                           'forcebly  putting the invaid query
  1568.                            'when  N1 >  FilterRecordCount to avoid unnessaray   looping between  intRecordRangeFrom TO  intRecordRangeTo
  1569.                              BuildRangeForQuery =strQuery &  " AND RecordNumber = 0 "
  1570.                 End If  
  1571.         Else            
  1572.                 Set objEnumerator = objService.ExecQuery(strQuery,"WQL",48,null)
  1573.                             For Each objInstance  In  objEnumerator
  1574.                                       currentMaxRecordnumber= objInstance.RecordNumber
  1575.                                   Exit for 
  1576.                             Next
  1577.  
  1578.                     If  currentMaxRecordnumber >   intMaxEventRecordsPresent then
  1579.                                  currentMinRecordnumber  = currentMaxRecordnumber - intMaxEventRecordsPresent
  1580.                                 intMaxEventRecordsPresent =  currentMaxRecordnumber         
  1581.                     End If 
  1582.                 Set objEnumerator= Nothing  'releases the memory 
  1583.  
  1584.             ' build the query
  1585.             BuildRangeForQuery =strQuery &  " AND RecordNumber >= "&  CLng(arrRangeValues(0))+ currentMinRecordnumber &  " AND RecordNumber <= " &   CLng(arrRangeValues(1)) + currentMinRecordnumber
  1586.  
  1587.         End If
  1588.     End If
  1589.  
  1590. End Function
  1591.  
  1592. '********************************************************************
  1593. '* Sub:     ShowEvents
  1594. '*
  1595. '* Purpose: Displays the EventLog details
  1596. '*
  1597. '* Input:   
  1598. '*  [in]    strMachine          machine to query events from
  1599. '*  [in]    strUserName         user name to connect to the machine
  1600. '*  [in]    strPassword         password for the user
  1601. '*  [in]    arrFilters          the array containing the filters
  1602. '*  [in]    strFormat           the display format
  1603. '*  [in]    strRange            the range of records required
  1604. '*  [in]    blnVerboseDisplay   flag to verify if verbose display is needed 
  1605. '*  [in]    blnNoHeader         flag to verify if noheader display is needed  
  1606. '*  [in]    objLogs             to store all the given logfles
  1607. '* Output:  Displays error message and quits if connection fails
  1608. '*          Calls component.showResults() to display the event records
  1609. '*
  1610. '********************************************************************
  1611. Private Sub ShowEvents(ByVal strMachine, _
  1612.                        ByVal strUserName, _
  1613.                        ByVal strPassword, _
  1614.                        ByRef arrFilters, _
  1615.                        ByVal strFormat, _
  1616.                        ByVal strRange, _
  1617.                        ByVal blnVerboseDisplay, _
  1618.                        ByVal blnNoHeader,_
  1619.                        ByRef objLogs)
  1620.  
  1621.     ON ERROR RESUME NEXT
  1622.     Err.Clear
  1623.  
  1624.     Dim objService         ' the WMI service object
  1625.     Dim objEnumerator      ' to store the results of the query is executed
  1626.     Dim objInstance        ' to refer to the instances of the objEnumerator
  1627.     Dim strFilterLog       ' to refer to each log specified by the user
  1628.     Dim strTemp            ' to store the temporary variables
  1629.     Dim strQuery           ' to store the query obtained for given conditions
  1630.     Dim arrResults         ' to store the columns of each filter
  1631.     Dim arrHeader          ' to store the array header values
  1632.     Dim arrMaxLength       ' to store the maximum length for each column
  1633.     Dim arrFinalResults    ' used to send the arrResults to component.showResults()
  1634.     Dim arrTemp            ' to store temporary array values
  1635.     Dim intLoopCount       ' used in the loop
  1636.     Dim intElementCount    ' used as array subscript
  1637.     Dim strFilterQuery     ' to store the query for the given filters
  1638.     Dim intResultCount     ' used to  count no of records that are fetched  in the query        
  1639.     Dim blnPrintHeader     ' used to  check header is printed or not in resulted Query
  1640.     
  1641.     ' the following are used for implementing the range option
  1642.     Dim intRecordRangeFrom    ' to store the display record beginning number
  1643.     Dim intRecordRangeTo      ' to store the display record ending number
  1644.     Dim arrKeyName            ' to  store then key value of  dictionary   object
  1645.     Dim strTempQuery          ' to store a string for -N range values 
  1646.     Dim arrblnDisplay         ' array to show the  status of display of verbose mode  for showresults function
  1647.     Dim intDataCount        ' used in looping to get value of  Insertion string for the field "Description column" 
  1648.     Dim i                   ' used for looping to enable All special privileges
  1649.     Dim objDateTimeObject   ' Object to get the date and time in the current locale/calender format.
  1650.  
  1651.    ' flag to set condition specific locale & default value setting
  1652.     Dim  bLocaleChanged 
  1653.     bLocaleChanged =FALSE
  1654.  
  1655.     'Validating the arguments which are passed from commandline     
  1656.     If NOT (ValidateArguments(strMachine, strUserName, strPassword, _
  1657.             arrFilters, strFormat, strRange , blnNoHeader)) Then
  1658.            WScript.Quit(EXIT_UNEXPECTED)
  1659.     End If
  1660.   
  1661.   
  1662.   ' checking for UNC format (\\machine) for the system  name
  1663.    If  Left(strMachine,2) =  UNC_Format_Servername  Then
  1664.             If Len(strMachine) = 2  Then    
  1665.                  component.vbPrintf InvalidInputErrorMessage ,Array(Wscript.ScriptName)
  1666.                  WScript.Quit(EXIT_UNEXPECTED)
  1667.           End if 
  1668.            strMachine = Mid(strMachine,3,Len(strMachine))
  1669.    End If
  1670.  
  1671.   'getting the password ....
  1672.     If ((strUserName <> VBEmpty) AND ((strPassword = VBEmpty) OR (strPassword = "*")))Then
  1673.              strPassword = component.getPassword()
  1674.     End If
  1675.  
  1676.  ' To set  GetSupportedUserLocale for Some  Diff locales 
  1677.     bLocaleChanged =GetSupportedUserLocale()
  1678.  
  1679.     'Establish a connection with the server.
  1680.     If NOT component.wmiConnect(CONST_NAMESPACE_CIMV2 , _
  1681.                       strUserName , _
  1682.                       strPassword , _
  1683.                       strMachine  , _
  1684.                       blnLocalConnection , _
  1685.                       objService  ) Then
  1686.  
  1687.             Wscript.Echo(L_HintCheckConnection_Message)         
  1688.             WScript.Quit(EXIT_METHOD_FAIL) 
  1689.         
  1690.     End If
  1691.  
  1692.     ' set the previlige's  To query  all event's in eventlog's . 
  1693.     objService.Security_.Privileges.AddAsString("SeSecurityPrivilege")
  1694.  
  1695.     'Enable all privileges as some DC's were requiring special privileges
  1696.     For i = 1 to 26
  1697.         objService.Security_.Privileges.Add(i)
  1698.     Next
  1699.  
  1700.     ' get the HostName from the function
  1701.     strMachine = component.getHostName( objService)
  1702.  
  1703.     ' Validating the Filter which is passed from commandline    
  1704.     If UBound(arrFilters) >= 0 Then 
  1705.         ' filters are specified. Validate them
  1706.         If Not  ValidateFilters(arrFilters,objService ) Then 
  1707.             WScript.Quit(EXIT_INVALID_INPUT)
  1708.         End If
  1709.     End If
  1710.     
  1711.   
  1712.     blnPrintHeader = TRUE
  1713.  
  1714.     If blnNoHeader Then
  1715.         blnPrintHeader = FALSE
  1716.     End If
  1717.  
  1718.     ' Initialize - header to display, the maximum length of each column and 
  1719.     '              number of columns present
  1720.     arrHeader = Array(L_ColHeaderType_Text,L_ColHeaderEventcode_Text, L_ColHeaderDateTime_Text,_
  1721.                           L_ColHeaderSource_Text,L_ColHeaderComputerName_Text)
  1722.     ' first initialize the array with N/A    
  1723.     arrResults = Array(L_TextNa_Text,L_TextNa_Text,L_TextNa_Text,L_TextNa_Text,L_TextNa_Text,L_TextNa_Text,_
  1724.                             L_TextNa_Text,L_TextNa_Text)
  1725.  
  1726.     arrMaxLength = Array(L_ColHeaderTypeLength_Text,L_ColHeaderEventcodeLength_Text, L_ColHeaderDateTimeLength_Text,_
  1727.              L_ColHeaderSourceLength_Text, L_ColHeaderComputerNameLength_Text, L_ColHeaderCategoryLength_Text,_
  1728.              L_ColHeaderUserLength_Text, L_ColHeaderDesriptionLength_Text)
  1729.  
  1730.     arrblnDisplay = Array(0, 0, 0, 0, 0, 1, 1, 1)
  1731.  
  1732.     If blnVerboseDisplay Then
  1733.         arrblnDisplay = Array(0, 0, 0, 0, 0, 0, 0,0)
  1734.         arrHeader = Array( L_ColHeaderType_Text,L_ColHeaderEventcode_Text, L_ColHeaderDateTime_Text, _
  1735.                           L_ColHeaderSource_Text,L_ColHeaderComputerName_Text,L_ColHeaderCategory_Text,_
  1736.                           L_ColHeaderUser_Text, L_ColHeaderDesription_Text) 
  1737.     End IF
  1738.  
  1739.         If UBound(arrFilters) >=0 Then
  1740.         strFilterQuery = BuildFiltersForQuery(arrFilters)
  1741.     End If
  1742.    
  1743.     ' call function to verify given log and also get records count in log
  1744.     Call VerifyLogAndGetMaxRecords(objService, objLogs)
  1745.  
  1746.     arrKeyName = objLogs.Keys 
  1747.  
  1748.     intResultCount = 0
  1749.     intLoopCount = 0
  1750.  
  1751.     ' not to display any blank line for CSV format 
  1752.     If Not ( Lcase(strFormat) =  Lcase(Const_Csv_Format_Text)) Then
  1753.         ' blank line before first data is displayed on console
  1754.         WScript.Echo EmptyLine_Text 
  1755.     End If
  1756.  
  1757.     Do While (intLoopCount < objLogs.Count)
  1758.  
  1759.         'setting Header to print every Log file  explicilty
  1760.         If blnNoHeader Then
  1761.             blnPrintHeader = FALSE
  1762.         Else
  1763.                 blnPrintHeader = TRUE
  1764.         End If
  1765.         
  1766.  
  1767.         If CLng(objLogs.Item(arrKeyName(intLoopCount))) > 0 Then        
  1768.             strFilterLog = arrKeyName(intLoopCount)
  1769.             intRecordRangeFrom = 0
  1770.             intRecordRangeTo = CLng(objLogs.Item(arrKeyName(intLoopCount))) 
  1771.             
  1772.             
  1773.             ' build the query
  1774.             strQuery = "Select * FROM Win32_NTLogEvent WHERE Logfile=" &_
  1775.                                 Chr(34) & strFilterLog & Chr(34)
  1776.  
  1777.             If UBound(arrFilters) >=0  Then
  1778.                 strQuery = strQuery & strFilterQuery 
  1779.             End If
  1780.  
  1781.             
  1782.             If Len(Trim(CStr(strRange))) > 0 Then
  1783.                 ' building again query  for -N  condition in range switch   
  1784.                 strQuery = BuildRangeForQuery(strRange,intRecordRangeFrom, _
  1785.                           intRecordRangeTo, UBound(arrFilters),strQuery,objService,strFilterLog)
  1786.                                
  1787.             End If
  1788.  
  1789.             ' process the results, else go for next log
  1790.             Set objEnumerator = objService.ExecQuery(strQuery,"WQL",48,null)
  1791.                 
  1792.  
  1793.             If  Err.Number Then
  1794.                 component.vbPrintf L_ExecuteQuery_ErrorMessage, Array(strFilterLog)
  1795.                 ' if error occurred in the query, go for next log
  1796.                 intLoopCount = intLoopCount + 1 
  1797.                 Err.clear      ' for next loop  if more logs present
  1798.             Else
  1799.  
  1800.                 intElementCount = 0
  1801.          
  1802.          ' Create DateTimeObject to get the date and time in user specific format.
  1803.           Set objDateTimeObject = CreateObject("ScriptingUtils.DateTimeObject")
  1804.  
  1805.             If Err.Number Then
  1806.                component.vbPrintf L_ComponentNotFound_ErrorMessage, Array("ScriptingUtils.DateTimeObject")
  1807.                 WScript.Quit(EXIT_METHOD_FAIL)
  1808.             End If
  1809.  
  1810.                 ReDim arrFinalResults(CONST_ARRAYBOUND_NUMBER) 
  1811.  
  1812.                 For each objInstance in objEnumerator
  1813.  
  1814.                     ' inside error trapping for most unexpected case...  
  1815.                     If Err.number   then  Exit For      
  1816.  
  1817.                     intResultCount = intResultCount + 1
  1818.                 
  1819.                         'print the header for each log file along  with Host Name 
  1820.                         'important:: if and only if we have Data 
  1821.                     If  intResultCount = 1 Then
  1822.                         ' not to display any header for CSV format 
  1823.                         If NOT ( Lcase(strFormat) =  Lcase(Const_Csv_Format_Text)) Then
  1824.                             WScript.Echo(String(78,"-"))
  1825.                             component.vbPrintf L_InfoDisplayLog_Message ,Array(strFilterLog,strMachine)
  1826.                             WScript.Echo(String(78,"-"))
  1827.                         End If
  1828.                     End If 
  1829.  
  1830.                     ' check whether the current record is fitting 
  1831.                     ' within the required range
  1832.                     If ( intResultCount >= intRecordRangeFrom ) And _
  1833.                        ( intResultCount <= intRecordRangeTo ) Then
  1834.                        ' record fitting the range ... this has to be displayed
  1835.  
  1836.                         If objInstance.Type <> "" Then
  1837.                             arrResults(0) = objInstance.Type
  1838.                         Else
  1839.                             arrResults(0) = L_TextNa_Text
  1840.                         End If
  1841.  
  1842.                         If objInstance.EventCode <> "" Then
  1843.                             arrResults(1) = objInstance.EventCode
  1844.                         Else
  1845.                             arrResults(1) = L_TextNa_Text
  1846.                         End If
  1847.  
  1848.                         If (NOT IsEmpty(objInstance.TimeGenerated)) Then
  1849.  
  1850.                             strTemp = objInstance.TimeGenerated
  1851.                                    
  1852.                                    'is LOCALE CHANGED   
  1853.                                  If bLocaleChanged <> TRUE Then
  1854.                                       'format DatTime as DATE & "Space" & TIME    
  1855. '                                        Use new sriptutil library dll version instead 
  1856.                                          arrResults(2) = objDateTimeObject.GetDateAndTime(strTemp)
  1857.                                   Else
  1858.                                      arrResults(2) = Mid(strTemp,5,2) & "/"  & Mid(strTemp,7,2) & "/"  &_
  1859.                                                Mid(strTemp,1,4) & " " & Mid(strTemp,9,2) & ":" &_
  1860.                                                Mid(strTemp,11,2) & ":" & Mid(strTemp,13,2)
  1861.                                  End  If 
  1862.                
  1863.                         Else
  1864.                                 arrResults(2) = L_TextNa_Text
  1865.                         End If
  1866.  
  1867.                         If objInstance.SourceName <> "" Then
  1868.                             arrResults(3) = objInstance.SourceName
  1869.                         Else
  1870.                             arrResults(3) = L_TextNa_Text
  1871.                         End If
  1872.  
  1873.                         If objInstance.ComputerName <> "" Then
  1874.                                 arrResults(4) =objInstance.ComputerName
  1875.                             Else
  1876.                                 arrResults(4) = L_TextNa_Text
  1877.                             End If
  1878.                         
  1879.                     If blnVerboseDisplay Then
  1880.                             If objInstance.CategoryString <> "" Then
  1881.                                 arrResults(5) = Replace(objInstance.CategoryString, VbCrLf, "")
  1882.                             Else
  1883.                                 arrResults(5) = L_TextNone_Text   ' None display
  1884.                             End If
  1885.  
  1886.                             If (NOT IsNull(objInstance.User)) Then
  1887.                                 arrResults(6) = objInstance.User
  1888.                             Else
  1889.                                 arrResults(6) = L_TextNa_Text
  1890.                             End If
  1891.  
  1892.                             If objInstance.Message <> "" Then
  1893.                                 arrResults(7) = Trim(Replace(Replace(objInstance.Message, VbCrLf, " "),VbCr," "))
  1894.                             Else
  1895.                                 'Check whether either value is present in "InsertionStrings" column .
  1896.                                 If (NOT IsNull(objInstance.InsertionStrings)) Then
  1897.                                     arrTemp = objInstance.InsertionStrings
  1898.                                     'removing default value "N/A"
  1899.                                     arrResults(7)= ""
  1900.                                     For intDataCount = 0 to UBound(arrTemp)
  1901.                                     arrResults(7) = arrResults(7) & " " & Trim(Replace(Replace(arrTemp(intDataCount), VbCrLf, " ") ,VbCr," "))
  1902.                                     Next
  1903.                                     arrResults(7) = Trim(arrResults(7))
  1904.                                 Else
  1905.                                     arrResults(7) = L_TextNa_Text
  1906.                                 End If
  1907.  
  1908.                             End If
  1909.  
  1910.                     End If
  1911.                         
  1912.                         ' add the record to the queue of records that has to be displayed
  1913.                         arrFinalResults( intElementCount ) = arrResults
  1914.                         intElementCount = intElementCount + 1       ' increment the buffer
  1915.                         ' check whether the output buffer is filled and ready for display
  1916.                         ' onto the screen or not
  1917.                         If intElementCount = CONST_ARRAYBOUND_NUMBER +1  Then
  1918.                                  ' Disable error handler  for any  broken pipe can catch by HOST
  1919.                                  On Error GoTo 0    
  1920.                                  ' Call the display function with required parameters
  1921.                                 Call  component.showResults(arrHeader, arrFinalResults, arrMaxLength, _
  1922.                                           strFormat, blnPrintHeader, arrblnDisplay)
  1923.                                 blnPrintHeader = FALSE
  1924.                                  ' Enable error handler 
  1925.                                 On Error Resume Next
  1926.                                 Redim arrFinalResults(CONST_ARRAYBOUND_NUMBER) ' clear the existing buffer contents
  1927.                                 intElementCount = 0     ' reset the buffer start
  1928.                         End If
  1929.                     End If
  1930.  
  1931.                     ' check whether the last record number that has to be displayed is
  1932.                     ' crossed or not ... if crossed exit the loop without proceeding further
  1933.                     If ( intResultCount >= intRecordRangeTo ) Then
  1934.                         ' max. TO range is crossed/reached ... no need of further looping
  1935.                         Exit For
  1936.                     End If
  1937.                 Next
  1938.  
  1939.       ' Release the component as we dont need it any more.
  1940.       Set objDateTimeObject = Nothing
  1941.  
  1942.                 ' check whether there any pending in the output buffer that has to be
  1943.                 ' displayed
  1944.                 If intElementCount > 0 Then
  1945.                     ' resize the array so that the buffer is shrinked to its content size
  1946.                     ReDim Preserve arrFinalResults( intElementCount - 1 )
  1947.                         ' Disable error handler  for any  broken pipe can catch by HOST
  1948.                          On Error GoTo 0    
  1949.                         ' Call the display function with required parameters
  1950.                        Call  component.showResults(arrHeader, arrFinalResults, arrMaxLength, _
  1951.                                 strFormat, blnPrintHeader, arrblnDisplay)
  1952.                                  ' Enable error handler 
  1953.                                 On Error Resume Next
  1954.                 Else            ' array bounds checking
  1955.                     If intResultCount = 0 Then
  1956.                           'ie no records found  
  1957.                         If  UBound(arrFilters) >= 0  OR Len(Trim(CStr(strRange))) > 0 Then 
  1958.                             ' message no records present  if  filter specified  
  1959.                             component.vbPrintf L_InfoNoRecordsInFilter_Message, Array(strFilterLog)
  1960.                         Else
  1961.                             'message  no records present if filter not  specified
  1962.                             component.vbPrintf L_InfoNoRecords_Message, Array(strFilterLog)
  1963.                         End If 
  1964.  
  1965.                     End If ' intResultCount = 0
  1966.  
  1967.                 End If ' array bounds checking
  1968.             End If 
  1969.         Else    
  1970.  
  1971.                       'message  no records present 
  1972.              component.vbPrintf L_InfoNoRecords_Message, Array(arrKeyName(intLoopCount))
  1973.  
  1974.             ' to print any blank line for LIST format if no records present 
  1975.             If  (Lcase(strFormat) =  Lcase(Const_LIST_Format_Text)) AND (intLoopCount < objLogs.Count )Then
  1976.                 ' blank line before end of the Next Each Log  file details
  1977.                 WScript.Echo EmptyLine_Text 
  1978.             END If 
  1979.  
  1980.  
  1981.         End If
  1982.  
  1983.         ' re-initialize all the needed variables
  1984.         intResultCount = 0 
  1985.         Set objEnumerator = Nothing
  1986.  
  1987.         intLoopCount = intLoopCount + 1
  1988.  
  1989.         ' display blank line for next log except List format    
  1990.         If  ( Lcase(strFormat) <>  Lcase(Const_LIST_Format_Text))  Then
  1991.             If (intLoopCount < objLogs.Count) then
  1992.                 ' blank line before end of the Next Each Log  file details
  1993.                 WScript.Echo EmptyLine_Text 
  1994.             End If  
  1995.         End If 
  1996.  
  1997.     Loop    ' do-while
  1998.  
  1999. End Sub
  2000.  
  2001. '********************************************************************
  2002. '* Function: GetSupportedUserLocale
  2003. '*
  2004. '* Purpose:This function checks if the current locale is supported or not.
  2005. '*
  2006. '* Output:   Returns TRUE or FALSE
  2007. '*
  2008. '********************************************************************
  2009. Private Function GetSupportedUserLocale()
  2010.  
  2011.  ON ERROR RESUME NEXT
  2012.  Err.Clear
  2013.  
  2014. GetSupportedUserLocale =FALSE
  2015.  
  2016. CONST LANG_ARABIC      =  &H01
  2017. CONST LANG_HEBREW      =  &H0d
  2018. CONST LANG_HINDI       =  &H39
  2019. CONST LANG_TAMIL       =  &H49
  2020. CONST LANG_THAI        =  &H1e 
  2021. CONST LANG_VIETNAMESE  =  &H2a
  2022.  
  2023. ' extract primary language id from a language id
  2024. ' i.e. PRIMARYLANGID(lgid)    ((WORD  )(lgid) & 0x3ff)
  2025. ' const for bitwise operation
  2026. CONST SUBID = 1023 '0x3ff
  2027.  
  2028. Dim Lcid                    ' to store LocaleId
  2029. Dim PrimarylangId           ' to store PRIMARYLANGID
  2030.  
  2031. ' get the current locale
  2032.  Lcid=GetLocale()
  2033.  
  2034. ' Convert LCID >>>>>>>>>>>>> PRIMARYLANGID
  2035. ' BIT Wise And Operation
  2036. ' formating to compare HEX Value's
  2037. PrimarylangId     = Hex ( Lcid AND  SUBID)
  2038.  
  2039. ' check whether the current locale is supported by our tool or not
  2040. ' if not change the locale to the English which is our default locale
  2041.  Select Case PrimarylangId
  2042.  
  2043.     ' here to check the values
  2044.     Case   Hex(LANG_ARABIC),Hex(LANG_HEBREW),Hex(LANG_THAI) ,Hex(LANG_HINDI ),Hex(LANG_TAMIL) ,Hex(LANG_VIETNAMESE)
  2045.  
  2046.              GetSupportedUserLocale =TRUE
  2047.              Exit Function
  2048.  End Select
  2049.  
  2050. End Function
  2051.  
  2052.  
  2053. ' ****************************************************************************************
  2054. '* Function : IsWinXP 
  2055. '*
  2056. '* Purpose:This function checks if the OS is Windows XP or newer.  
  2057. '*
  2058. '* Input:    [in]  Objservice     the service object
  2059. '* Output:   Returns TRUE or FALSE
  2060. '*
  2061. ' ****************************************************************************************
  2062.  
  2063. Private Function IsWinXP ( ByVal objService)
  2064.  
  2065.  ON ERROR RESUME NEXT
  2066.  Err.Clear
  2067.  
  2068.     CONST WIN2K_MAJOR_VERSION = 5000
  2069.     CONST WINXP_MAJOR_VERSION = 5001
  2070.  
  2071.     Dim strQuery            ' to store the query to be executed
  2072.     Dim objEnum             ' collection object
  2073.     Dim objInstance         ' instance object
  2074.     Dim strVersion          ' to store the OS version
  2075.     Dim arrVersionElements  ' to store the OS version elements
  2076.     Dim CurrentMajorVersion ' the major version number
  2077.  
  2078.    ISWinXP= FALSE
  2079.  
  2080.     strQuery = "Select * From  Win32_operatingsystem"
  2081.  
  2082.     Set objEnum = objService.ExecQuery(strQuery,"WQL",0,NULL)
  2083.  
  2084.     For each objInstance in objEnum
  2085.         strVersion= objInstance.Version
  2086.     Next
  2087.  
  2088.     ' OS Version : 5.1.xxxx(Windows XP), 5.0.xxxx(Windows 2000)
  2089.     arrVersionElements  = split(strVersion,".")
  2090.     ' converting to major version
  2091.     CurrentMajorVersion = arrVersionElements(0) * 1000 + arrVersionElements(1)
  2092.  
  2093.     ' Determine the OS Type
  2094.     '  WinXP  > Win2K  
  2095.     If CInt(CurrentMajorVersion) >=  CInt(WINXP_MAJOR_VERSION) Then
  2096.               IsWinXP= TRUE
  2097.    End If
  2098.  
  2099. End Function
  2100.  
  2101. ' ****************************************************************************************
  2102. '* Function : ExpandEnvironmentString()
  2103. '*
  2104. '* Purpose:This function Expands the Environment Variables
  2105. '*
  2106. '* Input:    [in]  strOriginalString      the string need to expand for EnvironmentsettingValue
  2107. '* Output:   Returns ExpandedEnvironmentString
  2108. '*
  2109. ' ****************************************************************************************
  2110. Private Function ExpandEnvironmentString( ByVal strOriginalString)
  2111.  
  2112.  ON ERROR RESUME NEXT
  2113.  Err.Clear
  2114.  
  2115. Dim ObjWshShell  ' Object to hold Shell
  2116.  
  2117. 'create the shell object
  2118. Set ObjWshShell = CreateObject("WScript.Shell")
  2119.  
  2120.     If Err.Number Then
  2121.          component.vbPrintf L_ComponentNotFound_ErrorMessage, Array("WScript.Shell")
  2122.          WScript.Quit(EXIT_METHOD_FAIL)
  2123.     End If
  2124.  
  2125.  'return the string 
  2126. ExpandEnvironmentString= ObjWshShell.ExpandEnvironmentStrings(strOriginalString)
  2127.  
  2128. End Function
  2129. '********************************************************************
  2130. '* Sub:     ShowUsage
  2131. '*
  2132. '* Purpose: Shows the correct usage to the user.
  2133. '*
  2134. '* Output:  Help messages are displayed on screen.
  2135. '*
  2136. '********************************************************************
  2137.  
  2138. Private Sub ShowUsage ()
  2139.  
  2140.     WScript.Echo EmptyLine_Text     
  2141.     WScript.Echo L_ShowUsageLine01_Text        
  2142.     WScript.Echo L_ShowUsageLine02_Text        
  2143.     WScript.Echo EmptyLine_Text     
  2144.     WScript.Echo L_ShowUsageLine03_Text        
  2145.     WScript.Echo L_ShowUsageLine04_Text        
  2146.     WScript.Echo L_ShowUsageLine05_Text        
  2147.     WScript.Echo EmptyLine_Text    
  2148.     WScript.Echo L_ShowUsageLine06_Text       
  2149.     WScript.Echo L_ShowUsageLine07_Text       
  2150.     WScript.Echo EmptyLine_Text      
  2151.     WScript.Echo L_ShowUsageLine08_Text       
  2152.     WScript.Echo L_ShowUsageLine09_Text      
  2153.     WScript.Echo EmptyLine_Text      
  2154.     WScript.Echo L_ShowUsageLine10_Text      
  2155.     WScript.Echo L_ShowUsageLine11_Text  
  2156.     WScript.Echo EmptyLine_Text       
  2157.     WScript.Echo L_ShowUsageLine12_Text         
  2158.     WScript.Echo L_ShowUsageLine13_Text  
  2159.     WScript.Echo L_ShowUsageLine14_Text        
  2160.     WScript.Echo EmptyLine_Text      
  2161.     WScript.Echo L_ShowUsageLine15_Text        
  2162.     WScript.Echo L_ShowUsageLine16_Text      
  2163.     WScript.Echo EmptyLine_Text  
  2164.     WScript.Echo L_ShowUsageLine17_Text      
  2165.     WScript.Echo L_ShowUsageLine18_Text  
  2166.     WScript.Echo L_ShowUsageLine19_Text      
  2167.    WScript.Echo EmptyLine_Text    
  2168.     WScript.Echo L_ShowUsageLine20_Text   
  2169.     WScript.Echo L_ShowUsageLine21_Text   
  2170.     WScript.Echo L_ShowUsageLine22_Text
  2171.     WScript.Echo L_ShowUsageLine23_Text 
  2172.     WScript.Echo L_ShowUsageLine24_Text      
  2173.     WScript.Echo EmptyLine_Text
  2174.     WScript.Echo L_ShowUsageLine25_Text      
  2175.     WScript.Echo L_ShowUsageLine26_Text  
  2176.     WScript.Echo L_ShowUsageLine27_Text         
  2177.    WScript.Echo EmptyLine_Text        
  2178.     WScript.Echo L_ShowUsageLine28_Text         
  2179.     WScript.Echo EmptyLine_Text         
  2180.     WScript.Echo L_ShowUsageLine29_Text        
  2181.     WScript.Echo EmptyLine_Text     
  2182.     WScript.Echo L_ShowUsageLine30_Text       
  2183.     WScript.Echo L_ShowUsageLine31_Text       
  2184.     WScript.Echo L_ShowUsageLine32_Text       
  2185.     WScript.Echo L_ShowUsageLine33_Text       
  2186.     WScript.Echo L_ShowUsageLine34_Text       
  2187.     WScript.Echo L_ShowUsageLine35_Text       
  2188.     WScript.Echo L_ShowUsageLine36_Text         
  2189.     WScript.Echo L_ShowUsageLine37_Text         
  2190.     WScript.Echo L_ShowUsageLine38_Text         
  2191.     WScript.Echo L_ShowUsageLine39_Text         
  2192.     WScript.Echo L_ShowUsageLine40_Text        
  2193.     WScript.Echo EmptyLine_Text 
  2194.     WScript.Echo L_ShowUsageLine41_Text       
  2195.     WScript.Echo L_ShowUsageLine42_Text        
  2196.     WScript.Echo EmptyLine_Text 
  2197.     WScript.Echo L_ShowUsageLine43_Text        
  2198.     WScript.Echo L_ShowUsageLine44_Text        
  2199.     WScript.Echo L_ShowUsageLine45_Text      
  2200.     WScript.Echo L_ShowUsageLine46_Text      
  2201.     WScript.Echo L_ShowUsageLine47_Text      
  2202.     WScript.Echo L_ShowUsageLine48_Text     
  2203.     WScript.Echo L_ShowUsageLine49_Text     
  2204.     WScript.Echo L_ShowUsageLine50_Text     
  2205.     WScript.Echo L_ShowUsageLine51_Text     
  2206.     WScript.Echo L_ShowUsageLine52_Text    
  2207.     WScript.Echo L_ShowUsageLine53_Text    
  2208.     WScript.Echo L_ShowUsageLine54_Text    
  2209.     WScript.Echo L_ShowUsageLine55_Text    
  2210. End Sub
  2211.  
  2212. '-----------------------------------------------------------------------------
  2213. '                            End of the Script                                
  2214. '-----------------------------------------------------------------------------
  2215.  
  2216.  
  2217. '' SIG '' Begin signature block
  2218. '' SIG '' MIIaLwYJKoZIhvcNAQcCoIIaIDCCGhwCAQExDjAMBggq
  2219. '' SIG '' hkiG9w0CBQUAMGYGCisGAQQBgjcCAQSgWDBWMDIGCisG
  2220. '' SIG '' AQQBgjcCAR4wJAIBAQQQTvApFpkntU2P5azhDxfrqwIB
  2221. '' SIG '' AAIBAAIBAAIBAAIBADAgMAwGCCqGSIb3DQIFBQAEELmj
  2222. '' SIG '' QQS0Y3CEMHawptKqDgegghS8MIICvDCCAiUCEEoZ0jiM
  2223. '' SIG '' glkcpV1zXxVd3KMwDQYJKoZIhvcNAQEEBQAwgZ4xHzAd
  2224. '' SIG '' BgNVBAoTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxFzAV
  2225. '' SIG '' BgNVBAsTDlZlcmlTaWduLCBJbmMuMSwwKgYDVQQLEyNW
  2226. '' SIG '' ZXJpU2lnbiBUaW1lIFN0YW1waW5nIFNlcnZpY2UgUm9v
  2227. '' SIG '' dDE0MDIGA1UECxMrTk8gTElBQklMSVRZIEFDQ0VQVEVE
  2228. '' SIG '' LCAoYyk5NyBWZXJpU2lnbiwgSW5jLjAeFw05NzA1MTIw
  2229. '' SIG '' MDAwMDBaFw0wNDAxMDcyMzU5NTlaMIGeMR8wHQYDVQQK
  2230. '' SIG '' ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMRcwFQYDVQQL
  2231. '' SIG '' Ew5WZXJpU2lnbiwgSW5jLjEsMCoGA1UECxMjVmVyaVNp
  2232. '' SIG '' Z24gVGltZSBTdGFtcGluZyBTZXJ2aWNlIFJvb3QxNDAy
  2233. '' SIG '' BgNVBAsTK05PIExJQUJJTElUWSBBQ0NFUFRFRCwgKGMp
  2234. '' SIG '' OTcgVmVyaVNpZ24sIEluYy4wgZ8wDQYJKoZIhvcNAQEB
  2235. '' SIG '' BQADgY0AMIGJAoGBANMuIPBofCwtLoEcsQaypwu3EQ1X
  2236. '' SIG '' 2lPYdePJMyqy1PYJWzTz6ZD+CQzQ2xtauc3n9oixncCH
  2237. '' SIG '' Jet9WBBzanjLcRX9xlj2KatYXpYE/S1iEViBHMpxlNUi
  2238. '' SIG '' WC/VzBQFhDa6lKq0TUrp7jsirVaZfiGcbIbASkeXarSm
  2239. '' SIG '' NtX8CS3TtDmbAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEA
  2240. '' SIG '' YVUOPnvHkhJ+ERCOIszUsxMrW+hE5At4nqR+86cHch7i
  2241. '' SIG '' We/MhOOJlEzbTmHvs6T7Rj1QNAufcFb2jip/F87lY795
  2242. '' SIG '' aQdzLrCVKIr17aqp0l3NCsoQCY/Os68olsR5KYSS3P+6
  2243. '' SIG '' Z0JIppAQ5L9h+JxT5ZPRcz/4/Z1PhKxV0f0RY2MwggQC
  2244. '' SIG '' MIIDa6ADAgECAhAIem1cb2KTT7rE/UPhFBidMA0GCSqG
  2245. '' SIG '' SIb3DQEBBAUAMIGeMR8wHQYDVQQKExZWZXJpU2lnbiBU
  2246. '' SIG '' cnVzdCBOZXR3b3JrMRcwFQYDVQQLEw5WZXJpU2lnbiwg
  2247. '' SIG '' SW5jLjEsMCoGA1UECxMjVmVyaVNpZ24gVGltZSBTdGFt
  2248. '' SIG '' cGluZyBTZXJ2aWNlIFJvb3QxNDAyBgNVBAsTK05PIExJ
  2249. '' SIG '' QUJJTElUWSBBQ0NFUFRFRCwgKGMpOTcgVmVyaVNpZ24s
  2250. '' SIG '' IEluYy4wHhcNMDEwMjI4MDAwMDAwWhcNMDQwMTA2MjM1
  2251. '' SIG '' OTU5WjCBoDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4x
  2252. '' SIG '' HzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsx
  2253. '' SIG '' OzA5BgNVBAsTMlRlcm1zIG9mIHVzZSBhdCBodHRwczov
  2254. '' SIG '' L3d3dy52ZXJpc2lnbi5jb20vcnBhIChjKTAxMScwJQYD
  2255. '' SIG '' VQQDEx5WZXJpU2lnbiBUaW1lIFN0YW1waW5nIFNlcnZp
  2256. '' SIG '' Y2UwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
  2257. '' SIG '' AQDAemGH67KnA2MbKxph3oC3FR2gi5A9uyeShBQ564XO
  2258. '' SIG '' KZIGZkikA0+N6E+n8K9e0S8Zx5HxtZ57kSHO6f/jTvD8
  2259. '' SIG '' r5VYuGMt5o72KRjNcI5Qw+2Wu0DbviXoQlXW9oXyBueL
  2260. '' SIG '' mRwx8wMP1EycJCrcGxuPgvOw76dN4xSn4I/Wx2jCYVip
  2261. '' SIG '' ctT4MEhP2S9vYyDZicqCe8JLvCjFgWjn5oJArEY6oPk/
  2262. '' SIG '' Ns1Mu1RCWnple/6E5MdHVKy5PeyAxxr3xDOBgckqlft/
  2263. '' SIG '' XjqHkBTbzC518u9r5j2pYL5CAapPqluoPyIxnxIV+XOh
  2264. '' SIG '' HoKLBCvqRgJMbY8fUC6VSyp4BoR0PZGPLEcxAgMBAAGj
  2265. '' SIG '' gbgwgbUwQAYIKwYBBQUHAQEENDAyMDAGCCsGAQUFBzAB
  2266. '' SIG '' hiRodHRwOi8vb2NzcC52ZXJpc2lnbi5jb20vb2NzcC9z
  2267. '' SIG '' dGF0dXMwCQYDVR0TBAIwADBEBgNVHSAEPTA7MDkGC2CG
  2268. '' SIG '' SAGG+EUBBwEBMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8v
  2269. '' SIG '' d3d3LnZlcmlzaWduLmNvbS9ycGEwEwYDVR0lBAwwCgYI
  2270. '' SIG '' KwYBBQUHAwgwCwYDVR0PBAQDAgbAMA0GCSqGSIb3DQEB
  2271. '' SIG '' BAUAA4GBAC3zT2NgLBja9SQPUrMM67O8Z4XCI+2PRg3P
  2272. '' SIG '' Gk2+83x6IDAyGGiLkrsymfCTuDsVBid7PgIGAKQhkoQT
  2273. '' SIG '' CsWY5UBXxQUl6K+vEWqp5TvL6SP2lCldQFXzpVOdyDY6
  2274. '' SIG '' OWUIc3OkMtKvrL/HBTz/RezD6Nok0c5jrgmn++Ib4/1B
  2275. '' SIG '' CmqWMIIEEjCCAvqgAwIBAgIPAMEAizw8iBHRPvZj7N9A
  2276. '' SIG '' MA0GCSqGSIb3DQEBBAUAMHAxKzApBgNVBAsTIkNvcHly
  2277. '' SIG '' aWdodCAoYykgMTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAc
  2278. '' SIG '' BgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8G
  2279. '' SIG '' A1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0aG9yaXR5MB4X
  2280. '' SIG '' DTk3MDExMDA3MDAwMFoXDTIwMTIzMTA3MDAwMFowcDEr
  2281. '' SIG '' MCkGA1UECxMiQ29weXJpZ2h0IChjKSAxOTk3IE1pY3Jv
  2282. '' SIG '' c29mdCBDb3JwLjEeMBwGA1UECxMVTWljcm9zb2Z0IENv
  2283. '' SIG '' cnBvcmF0aW9uMSEwHwYDVQQDExhNaWNyb3NvZnQgUm9v
  2284. '' SIG '' dCBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  2285. '' SIG '' DwAwggEKAoIBAQCpAr3BcOY78k4bKJ+XeF4w6qKpjSVf
  2286. '' SIG '' +P6VTKO3/p2iID58UaKboo9gMmvRQmR57qx2yVTa8uuc
  2287. '' SIG '' hhyPn4Rms8VremIj1h083g8BkuiWxL8tZpqaaCaZ0Dos
  2288. '' SIG '' vwy1WCbBRucKPjiWLKkoOajsSYNC44QPu5psVWGsgnyh
  2289. '' SIG '' YC13TOmZtGQ7mlAcMQgkFJ+p55ErGOY9mGMUYFgFZZ8d
  2290. '' SIG '' N1KH96fvlALGG9O/VUWziYC/OuxUlE6u/ad6bXROrxjM
  2291. '' SIG '' lgkoIQBXkGBpN7tLEgc8Vv9b+6RmCgim0oFWV++2O14W
  2292. '' SIG '' gXcE2va+roCV/rDNf9anGnJcPMq88AijIjCzBoXJsyB3
  2293. '' SIG '' E4XfAgMBAAGjgagwgaUwgaIGA1UdAQSBmjCBl4AQW9Bw
  2294. '' SIG '' 72lyniNRfhSyTY7/y6FyMHAxKzApBgNVBAsTIkNvcHly
  2295. '' SIG '' aWdodCAoYykgMTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAc
  2296. '' SIG '' BgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8G
  2297. '' SIG '' A1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0aG9yaXR5gg8A
  2298. '' SIG '' wQCLPDyIEdE+9mPs30AwDQYJKoZIhvcNAQEEBQADggEB
  2299. '' SIG '' AJXoC8CN85cYNe24ASTYdxHzXGAyn54Lyz4FkYiPyTrm
  2300. '' SIG '' IfLwV5MstaBHyGLv/NfMOztaqTZUaf4kbT/JzKreBXzd
  2301. '' SIG '' MY09nxBwarv+Ek8YacD80EPjEVogT+pie6+qGcgrNyUt
  2302. '' SIG '' vmWhEoolD2Oj91Qc+SHJ1hXzUqxuQzIH/YIX+OVnbA1R
  2303. '' SIG '' 9r3xUse958Qw/CAxCYgdlSkaTdUdAqXxgOADtFv0sd3I
  2304. '' SIG '' V+5lScdSVLa0AygS/5DW8AiPfriXxas3LOR65Kh343ag
  2305. '' SIG '' ANBqP8HSNorgQRKoNWobats14dQcBOSoRQTIWjM4bk0c
  2306. '' SIG '' DWK3CqKM09VUP0bNHFWmcNsSOoeTdZ+n0qAwggTJMIID
  2307. '' SIG '' saADAgECAhBqC5lPwADeqhHU2ECaqL7mMA0GCSqGSIb3
  2308. '' SIG '' DQEBBAUAMHAxKzApBgNVBAsTIkNvcHlyaWdodCAoYykg
  2309. '' SIG '' MTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAcBgNVBAsTFU1p
  2310. '' SIG '' Y3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8GA1UEAxMYTWlj
  2311. '' SIG '' cm9zb2Z0IFJvb3QgQXV0aG9yaXR5MB4XDTAwMTIxMDA4
  2312. '' SIG '' MDAwMFoXDTA1MTExMjA4MDAwMFowgaYxCzAJBgNVBAYT
  2313. '' SIG '' AlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQH
  2314. '' SIG '' EwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29y
  2315. '' SIG '' cG9yYXRpb24xKzApBgNVBAsTIkNvcHlyaWdodCAoYykg
  2316. '' SIG '' MjAwMCBNaWNyb3NvZnQgQ29ycC4xIzAhBgNVBAMTGk1p
  2317. '' SIG '' Y3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBMIIBIDANBgkq
  2318. '' SIG '' hkiG9w0BAQEFAAOCAQ0AMIIBCAKCAQEAooQVU9gLMA40
  2319. '' SIG '' lf86G8LzL3ttNyNN89KM5f2v/cUCNB8kx+Wh3FTsfgJ0
  2320. '' SIG '' R6vbMlgWFFEpOPF+srSMOke1OU5uVMIxDDpt+83Ny1Cc
  2321. '' SIG '' G66n2NlKJj+1xcuPluJJ8m3Y6ZY+3gXP8KZVN60vYM2A
  2322. '' SIG '' YUKhSVRKDxi3S9mTmTBaR3VktNO73barDJ1PuHM7GDqq
  2323. '' SIG '' tIeMsIiwTU8fThG1M4DfDTpkb0THNL1Kk5u8ph35BSNO
  2324. '' SIG '' YCmPzCryhJqZrajbCnB71jRBkKW3ZsdcGx2jMw6bVAMa
  2325. '' SIG '' P5iQuMznPQR0QxyP9znms6xIemsqDmIBYTl2bv0+mAdL
  2326. '' SIG '' FPEBRv0VAOBH2k/kBeSAJQIBA6OCASgwggEkMBMGA1Ud
  2327. '' SIG '' JQQMMAoGCCsGAQUFBwMDMIGiBgNVHQEEgZowgZeAEFvQ
  2328. '' SIG '' cO9pcp4jUX4Usk2O/8uhcjBwMSswKQYDVQQLEyJDb3B5
  2329. '' SIG '' cmlnaHQgKGMpIDE5OTcgTWljcm9zb2Z0IENvcnAuMR4w
  2330. '' SIG '' HAYDVQQLExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xITAf
  2331. '' SIG '' BgNVBAMTGE1pY3Jvc29mdCBSb290IEF1dGhvcml0eYIP
  2332. '' SIG '' AMEAizw8iBHRPvZj7N9AMBAGCSsGAQQBgjcVAQQDAgEA
  2333. '' SIG '' MB0GA1UdDgQWBBQpXLkbts0z7rueWX335couxA00KDAZ
  2334. '' SIG '' BgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8E
  2335. '' SIG '' BAMCAUYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B
  2336. '' SIG '' AQQFAAOCAQEARVjimkF//J2/SHd3rozZ5hnFV7QavbS5
  2337. '' SIG '' XwKhRWo5Wfm5J5wtTZ78ouQ4ijhkIkLfuS8qz7fWBsrr
  2338. '' SIG '' Kr/gGoV821EIPfQi09TAbYiBFURfZINkxKmULIrbkDdK
  2339. '' SIG '' D7fo1GGPdnbh2SX/JISVjQRWVJShHDo+grzupYeMHIxL
  2340. '' SIG '' eV+1SfpeMmk6H1StdU3fZOcwPNtkSUT7+8QcQnHmoD1F
  2341. '' SIG '' 7msAn6xCvboRs1bk+9WiKoHYH06iVb4nj3Cmomwb/1SK
  2342. '' SIG '' gryBS6ahsWZ6qRenywbAR+ums+kxFVM9KgS//3NI3Isn
  2343. '' SIG '' Q/xj6O4kh1u+NtHoMfUy2V7feXq6MKxphkr7jBG/G41U
  2344. '' SIG '' WTCCBQ8wggP3oAMCAQICCmEHEUMAAAAAADQwDQYJKoZI
  2345. '' SIG '' hvcNAQEFBQAwgaYxCzAJBgNVBAYTAlVTMRMwEQYDVQQI
  2346. '' SIG '' EwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4w
  2347. '' SIG '' HAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKzAp
  2348. '' SIG '' BgNVBAsTIkNvcHlyaWdodCAoYykgMjAwMCBNaWNyb3Nv
  2349. '' SIG '' ZnQgQ29ycC4xIzAhBgNVBAMTGk1pY3Jvc29mdCBDb2Rl
  2350. '' SIG '' IFNpZ25pbmcgUENBMB4XDTAyMDUyNTAwNTU0OFoXDTAz
  2351. '' SIG '' MTEyNTAxMDU0OFowgaExCzAJBgNVBAYTAlVTMRMwEQYD
  2352. '' SIG '' VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k
  2353. '' SIG '' MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x
  2354. '' SIG '' KzApBgNVBAsTIkNvcHlyaWdodCAoYykgMjAwMiBNaWNy
  2355. '' SIG '' b3NvZnQgQ29ycC4xHjAcBgNVBAMTFU1pY3Jvc29mdCBD
  2356. '' SIG '' b3Jwb3JhdGlvbjCCASIwDQYJKoZIhvcNAQEBBQADggEP
  2357. '' SIG '' ADCCAQoCggEBAKqZvTmoGCf0Kz0LTD98dy6ny7XRjA3C
  2358. '' SIG '' OnTXk7XgoEs/WV7ORU+aeSnxScwaR+5Vwgg+EiD4VfLu
  2359. '' SIG '' X9Pgypa8MN7+WMgnMtCFVOjwkRC78yu+GeUDmwuGHfOw
  2360. '' SIG '' OYy4/QsdPHMmrFcryimiFZCCFeJ3o0BSA4udwnC6H+k0
  2361. '' SIG '' 9vM1kk5Vg/jaMLYg3lcGtVpCBt5Zy/Lfpr0VR3EZJSPS
  2362. '' SIG '' y2+bGXnfalvxdgV5KfzDVsqPRAiFVYrLyA9GS1XLjJZ3
  2363. '' SIG '' SofoqUEGx/8N6WhXY3LDaVe0Q88yOjDcG+nVQyYqef6V
  2364. '' SIG '' 2yJnJMkv0DTj5vtRSYa4PNAlX9bsngNhh6loQMf44gPm
  2365. '' SIG '' zwUCAwEAAaOCAUAwggE8MA4GA1UdDwEB/wQEAwIGwDAT
  2366. '' SIG '' BgNVHSUEDDAKBggrBgEFBQcDAzAdBgNVHQ4EFgQUa8jG
  2367. '' SIG '' USDwtC/ToLauf14msriHUikwgakGA1UdIwSBoTCBnoAU
  2368. '' SIG '' KVy5G7bNM+67nll99+XKLsQNNCihdKRyMHAxKzApBgNV
  2369. '' SIG '' BAsTIkNvcHlyaWdodCAoYykgMTk5NyBNaWNyb3NvZnQg
  2370. '' SIG '' Q29ycC4xHjAcBgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3Jh
  2371. '' SIG '' dGlvbjEhMB8GA1UEAxMYTWljcm9zb2Z0IFJvb3QgQXV0
  2372. '' SIG '' aG9yaXR5ghBqC5lPwADeqhHU2ECaqL7mMEoGA1UdHwRD
  2373. '' SIG '' MEEwP6A9oDuGOWh0dHA6Ly9jcmwubWljcm9zb2Z0LmNv
  2374. '' SIG '' bS9wa2kvY3JsL3Byb2R1Y3RzL0NvZGVTaWduUENBLmNy
  2375. '' SIG '' bDANBgkqhkiG9w0BAQUFAAOCAQEANSP9E1T86dzw3QwU
  2376. '' SIG '' evqns879pzrIuuXn9gP7U9unmamgmzacA+uCRxwhvRTL
  2377. '' SIG '' 52dACccWkQJVzkNCtM0bXbDzMgQ9EuUdpwenj6N+RVV2
  2378. '' SIG '' G5aVkWnw3TjzSInvcEC327VVgMADxC62KNwKgg7HQ+N6
  2379. '' SIG '' SF24BomSQGxuxdz4mu8LviEKjC86te2nznGHaCPhs+QY
  2380. '' SIG '' fbhHAaUrxFjLsolsX/3TLMRvuCOyDf888hFFdPIJBpkY
  2381. '' SIG '' 3W/AhgEYEh0rFq9W72UzoepnTvRLgqvpD9wB+t9gf2ZH
  2382. '' SIG '' XcsscMx7TtkGuG6MDP5iHkL5k3yiqwqe0CMQrk17J5Fv
  2383. '' SIG '' Jr5o+qY/nyPryJ27hzGCBN0wggTZAgEBMIG1MIGmMQsw
  2384. '' SIG '' CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ
  2385. '' SIG '' MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z
  2386. '' SIG '' b2Z0IENvcnBvcmF0aW9uMSswKQYDVQQLEyJDb3B5cmln
  2387. '' SIG '' aHQgKGMpIDIwMDAgTWljcm9zb2Z0IENvcnAuMSMwIQYD
  2388. '' SIG '' VQQDExpNaWNyb3NvZnQgQ29kZSBTaWduaW5nIFBDQQIK
  2389. '' SIG '' YQcRQwAAAAAANDAMBggqhkiG9w0CBQUAoIGqMBkGCSqG
  2390. '' SIG '' SIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQBgjcC
  2391. '' SIG '' AQsxDjAMBgorBgEEAYI3AgEVMB8GCSqGSIb3DQEJBDES
  2392. '' SIG '' BBDaMnDARVd2uJyaAxK0dOXIME4GCisGAQQBgjcCAQwx
  2393. '' SIG '' QDA+oB6AHABFAHYAZQBuAHQAUQB1AGUAcgB5AC4AdgBi
  2394. '' SIG '' AHOhHIAad3d3Lm1pY3Jvc29mdC5jb20vd2luZG93cyAw
  2395. '' SIG '' DQYJKoZIhvcNAQEBBQAEggEAPf6uEojLWzpkv15s5nmE
  2396. '' SIG '' MG5uPg5iWWzffTn8e8FHNyheB2CxrLG0PrGw+GAIiT+f
  2397. '' SIG '' lwN2LZfj/KDgRrMGIB6WP5rs46cEHn/44xs/Y7QfOX92
  2398. '' SIG '' djs+nRnug48PbhAt37ZTSq7uZv58UBb/YAGN/v5vw5BB
  2399. '' SIG '' RAuecTE1J+twxAsX2B/sqXpiczL26lnxehDkI0Jdqfi4
  2400. '' SIG '' a/0NeukzSBj3OgOPPMktwVKi/0oPqm31DbwOzAgm+GLy
  2401. '' SIG '' ag34tmUfA7W+uwQRjnm+jyQ+ZGMLyGIaPjYMmgw9ewJP
  2402. '' SIG '' 2+G/yd9ROG8VjL+GX9k6EUUinzA34wH/Zds6tsZtpIHg
  2403. '' SIG '' HTYTkBbsHZA34aGCAkwwggJIBgkqhkiG9w0BCQYxggI5
  2404. '' SIG '' MIICNQIBATCBszCBnjEfMB0GA1UEChMWVmVyaVNpZ24g
  2405. '' SIG '' VHJ1c3QgTmV0d29yazEXMBUGA1UECxMOVmVyaVNpZ24s
  2406. '' SIG '' IEluYy4xLDAqBgNVBAsTI1ZlcmlTaWduIFRpbWUgU3Rh
  2407. '' SIG '' bXBpbmcgU2VydmljZSBSb290MTQwMgYDVQQLEytOTyBM
  2408. '' SIG '' SUFCSUxJVFkgQUNDRVBURUQsIChjKTk3IFZlcmlTaWdu
  2409. '' SIG '' LCBJbmMuAhAIem1cb2KTT7rE/UPhFBidMAwGCCqGSIb3
  2410. '' SIG '' DQIFBQCgWTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcB
  2411. '' SIG '' MBwGCSqGSIb3DQEJBTEPFw0wMjA3MTUyMjEyNDBaMB8G
  2412. '' SIG '' CSqGSIb3DQEJBDESBBB+VnFaley0kGY2xc8t1vJEMA0G
  2413. '' SIG '' CSqGSIb3DQEBAQUABIIBAIR3KgNSALKTeXW2KnX5jWzL
  2414. '' SIG '' tRAl+F/+HbCW6D0QGpGlg/OaCUHHF/d0M3fak8SKtrYM
  2415. '' SIG '' 17zhHxqT2HqsoorcMOnyYjIKrW1XMD6sHZTa+1bbOriy
  2416. '' SIG '' z4N6zqeNKzXffYsXyIdM60csQ7romWZm0H5+RjP/WtHT
  2417. '' SIG '' K3KA3YgHLBWMm2B0U4mmEgNHL0GQwXg/zRONB9Q+GWcA
  2418. '' SIG '' LwSodGbOk256VgWqHpmErPjwHKCcHRcBBFphYRZeIwyd
  2419. '' SIG '' c2YNb7y8B33uQc3glXna8FWBR9BUXOMbm7UWqlycmBRp
  2420. '' SIG '' jM3MvVBUPEeV3wLTVtUwKg4Os4jse3Qb4e1ovWqrcnwA
  2421. '' SIG '' f9rNehliStQ=
  2422. '' SIG '' End signature block
  2423.